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

问题描述

您好,

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

解决方案



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#.

解决方案


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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 14:36