How to add a "label" to an edge?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to add a "label" to an edge?

Welson Sun
Hi,

I see this LabeledElement interface in JGraphT, but it seems that neither
the vertex nor the edge in JGraphT implements the LabeledElement interface?

For the vertex, this may not be a problem, since the vertex can be an
"Object". But what if I want to assign a "label" or an "Object" to an edge?


Welson




Reply | Threaded
Open this post in threaded view
|

Re: How to add a "label" to an edge?

John Sichi
Administrator
Hi Welson,

It seems LabeledElement never really got implemented, so for now its
presence is just confusing.

If you want to add a label to an edge, all you need to do is write your
own edge class (probably subclassing one of the existing ones such as
DirectedEdge) and add whatever attributes you want there.  And supply a
corresponding edge factory to your graph.

JVS

Welson Sun wrote:

> Hi,
>
> I see this LabeledElement interface in JGraphT, but it seems that neither
> the vertex nor the edge in JGraphT implements the LabeledElement interface?
>
> For the vertex, this may not be a problem, since the vertex can be an
> "Object". But what if I want to assign a "label" or an "Object" to an edge?
>
>
> Welson
>
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> jgrapht-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jgrapht-users
>