kmcellhenney

unread,

Oct 25, 2007, 7:25:38 PM10/25/07

to Flex Visual Graph Library

Is it possible to create a graph that shows multiple edges that
connect the same two nodes?
Something like a diamond shape but with the ability to have n edges
that conenct the two nodes (see my feeble attempt below).

[ ] [ ]
/ \ / | \
\ / \ | /
[ ] [ ]

quintero...@gmail.com

unread,

Oct 25, 2007, 7:58:10 PM10/25/07

to Flex Visual Graph Library

Of course it's possible. In the edgeRenderer class, get all the
concurrent edges to the destination node of this edge. Internal edge
id will decide the position of each node (left, middle, right, ...),
for instance:

Node Source 'A'
*******************
Edge id: 10 (1st position)
Edge id: 34 (4th position)
Edge id: 32 (3rd position)
Edge id: 23 (2nd position)
************************
Node Destination 'B'

When you draw each edge, get its relative position and then calculate
the middle edge point, using an easy geom. function (using cos, sin
and atan):

[node A]
|
/|\
\|/
|
[node B}

kmcellhenney

unread,

Oct 25, 2007, 8:06:25 PM10/25/07

to Flex Visual Graph Library

I guess what I was asking was is there already a builtin layout that
will handle this.
Also after looking into the code in
org.un.flex.graphLayout.data.Graph.as it does not allow multiple
edges that connect the same two nodes so I guess a new class would
need to be created to handle this.

On Oct 25, 1:58 pm, "quintero.ferna...@gmail.com"

JB

unread,

Oct 26, 2007, 9:42:05 AM10/26/07

to Flex Visual Graph Library

You're right, there is not a built in class to handle multiple edges
with the same source and target. There are a few intermediate hacks
that you could do in the interim.

1.) You could create a modified flowedgerenderer. The flow edge
renderer takes a parameter from the edge xml such as flow="3" - in
it's current form, this draws an edge with a respective thickness.
The idea here is to have Flow Map graphs.

2.) Based on this renderer you could customize your own to draw
multiple edges instead of one. Of course the data would be different,
e.g. you would not have multiple edge records but one that aggregates
the number, e.g. 3 links between two nodes is described as flow="3".

3.) We'll look into the possibilities of handling multiple edges in
the meantime.

Let me know if the above would work?

Reply all

Reply to author

Forward