用于在C#中绘制节点和树的边缘的Api [英] Api for Drawing nodes and edges of tree in C#

查看:95
本文介绍了用于在C#中绘制节点和树的边缘的Api的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在处理一个项目,我需要绘制一个树(节点,边缘,成本)。我不知道哪个API会有用。请建议我使用C#的Api。

解决方案

结帐:

Microsoft自动图形布局(MSAGL) [ ^ ],以前称为GLEE,来自Microsoft Research。


AhmedSiddiquewrote:

成本意味着路径的价值正确的术语是权重。请参阅: http://en.wikipedia.org/wiki/Graph_%28mathematics%29#Weighted_graph [ ^ ]。



此功能我或不可实现。不是吗?不用担心。请记住,您不需要一般结构图,只需要树,这使得大多数问题变得非常简单: http://en.wikipedia.org/wiki/Tree_%28graph_theory%29 [ ^ ]。



尤其要承担这个重量。如果您想一点,您可以看到解决方法非常简单:您可以方便地将权重存储在每个节点中。为什么?因为,在树中,每个节点都有0或1个父节点,0仅适用于根节点。因此,您将存储所有边的权重,因为每个节点(您可以忽略的根除了它,无论它存储什么)只有一条边连接到它的父节点。当您在除根之外的每个节点中存储一些权重值时,您可以对所有边缘进行加权。问题解决了。



再次,为什么你不能使用.NET中可用的 TreeView 类之一FCL?这是另一种解决方案,权重问题的解决方法与我上面解释的完全相同。



-SA


Hello,
i am working on a project and i need to draw a tree(nodes,edges,cost). I don''t have any idea which API will be useful . Please Suggest me an Api for C#.

解决方案

Checkout:
Microsoft Automatic Graph Layout (MSAGL)[^], formerly known as GLEE, from Microsoft Research.


AhmedSiddiquewrote:

Cost means value of a path

The correct term for it is "weight". Please see: http://en.wikipedia.org/wiki/Graph_%28mathematics%29#Weighted_graph[^].

This feature my or may no be implemented. Is it not? Not to worry. Remember that you don''t require a graphs of general structure, you merely need trees, which makes most problems extremely simplified: http://en.wikipedia.org/wiki/Tree_%28graph_theory%29[^].

In particular, take that weight. If you think just a bit, you can see that the workaround is very simple: you can conveniently store the weight in each node. Why? Because, in a tree, every node has 0 or 1 parents, 0 only for a root node. So, you will store weight of all edges, as each node (except the root, which you can simply ignore, no matter what it stores) has only one edge connecting it to its parent. When you store some weight value in each node except the root, you have all you edges weighted. Problem solved.

Again, why won''t you use one of the TreeView classes available in .NET FCL? This is another solution, and the problem of weights is solved in exact same way as I explained above.

—SA


这篇关于用于在C#中绘制节点和树的边缘的Api的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆