Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'graphing interesting linked lists' topicStudent Support Forum > General > "graphing interesting linked lists"

Next Comment >Help | Reply To Topic
Author Comment/Response
Gabby
05/20/10 10:51pm

Hello, I need to find a way to graph and distinguish two linked lists that intersect, that is, they share a common node. The problem is, graphically once the lists intersect I can't tell which list is which. For example, suppose I have two lists:

list1 = {1 -> 2, 2 -> 3, 3 -> 9};
list2 = {5 -> 2, 2 -> 6};

Notice both lists have "2" in common, but list1 then links to 3 while list2 links to 6. If I combine both lists into a single list, list3:

list3 = {1 -> 2, 2 -> 3, 3 -> 9, 5 -> 2, 2 -> 6};

And then:

LayeredGraphPlot[list3, Left, VertexLabeling -> True]

I get a plot, but I can't tell list1 from list2 once they both intersect at node 2. So is there a way to graphically distinguish between list1 and list2?

Thanks!

URL: ,

Subject (listing for 'graphing interesting linked lists')
Author Date Posted
graphing interesting linked lists Gabby 05/20/10 10:51pm
Re: graphing interesting linked lists Peter Pein 05/23/10 06:19am
Re: Re: graphing interesting linked lists Gabby 05/25/10 00:25am
Re: graphing interesting linked lists yehuda ben-s... 05/23/10 10:04pm
Next Comment >Help | Reply To Topic