Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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#.
Posted
Comments
Sergey Alexandrovich Kryukov 16-May-13 17:04pm    
You already got one interesting answer by now, but I wonder why don't you want to just use one of the classes named TreeView and available in .NET GAC.
And you always should tag the UI library or application type you are using. Who will take a labor of answering your question in many different variants if you probably need only one?
—SA

Checkout:
Microsoft Automatic Graph Layout (MSAGL)[^], formerly known as GLEE, from Microsoft Research.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 16-May-13 17:02pm    
Interesting thing, a 5.
—SA
Matt T Heffron 16-May-13 17:04pm    
Thanks. Tracking the RSS feeds from Microsoft Research is interesting!
Sergey Alexandrovich Kryukov 16-May-13 17:05pm    
Good idea.
—SA
AhmedSiddique 17-May-13 7:19am    
Thanks for your suggestion
but i have problem in setting left child and right child of a parent node
how to should i do it?

Sergey Alexandrovich Kryukov 17-May-13 9:30am    
Your description of your problem is not informative...
—SA
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900