views:

31

answers:

1

I'm trying to draw a directed graph with labels on edges. I'm using graph# (graphsharp) and quickgraph, and I saw an explanation in the forums about how to add labels (it is not supported by the library), but cannot manage to implement myself. If someone could provide a working example using these two libraries I would be very thankful.

Update: I'm now looking for something a little more complicated: My edges behave like nodes, they have connections to other nodes and have a name-tag. So they are like any other node, and when I draw the graph these edge-nodes must appear exactly in the middle of a certain connections. Any ideas?

A: 

Although it's not documented, QuickGraph supports output to other formats, like DGML. VS 2010 includes a very basic DGML viewer. It may be possible to output DGML so that the resulting graph has edge labels. However you will likely need to add support yourself.

Download the QuickGraph sources and play around with it. I'm a committer on the project, so if you figure it out let me know and we'll get your changes into the project.

RyanHennig
Thanks for the answer. I'm now looking for something a little more complicated: My edges behave like nodes, they have connections to other nodes and have a name-tag, so they are like any other node, only they are snapped to certain connections, And I need to draw all this. Any ideas?
Uri
My experience with QuickGraph is mainly around using it for graph algorithms. I would encourage you to contribute to the Graph# library: either create some documentation if they already have what you need, or talk to them about how the feature can be added (by you or somebody else). Remember, use the force, read the source :-)
RyanHennig