Re: [jgrapht-users] Impossible to set source and target of DefaultEdge
Brought to you by:
barak_naveh,
perfecthash
From: John S. <js...@gm...> - 2011-07-12 18:34:40
|
It's a default edge implementation meant as a companion to the out-of-the-box graph implementations. It's rare to need to write your own graph implementation from scratch (rather than extending or decorating one of the out-of-the-box ones), but if you do, then providing your own edge implementation is going to be the least of your concerns. JVS On Mon, Jul 11, 2011 at 10:43 AM, Anant Rathi <ar...@21...> wrote: > Hey Rob, > > > > Thanks for your response. I understand that EdgeFactories are much preferred > to constructors and that graphs are used to query source and target, but in > the case of DefaultEdge, I don’t see how it’s possible for the system to > work. > > > > A factory that constructs DefaultEdges cannot set their source and target. > And calling getEdgeSource() or getEdgeTarget() on a > Graph<whatever,DefaultEdge> is essentially meaningless since every pair of > DefaultEdges in the graph are equal(). > > > > I’ve investigated the source code a bit further, and DefaultEdge extends > IntrusiveEdge, which has the source and target members’ scope as > package-private. So graph implementations provided by JGraphT itself > (DefaultDirectedGraph, etc.) can (and do) set the source and target of > DefaultEdges , and therefore can (and do) correctly implement > getEdgeSource() and getEdgeTarget(). But for the rest of us, I think it’s > impossible to guarantee correctness of these two methods when Defaultedge is > the edge type. > > > > Anant > > > > From: Rob Patro [mailto:rob...@gm...] > Sent: Monday, July 11, 2011 12:07 PM > To: jgr...@li... > Subject: Re: [jgrapht-users] Impossible to set source and target of > DefaultEdge > > > > Hi Anant, > > JGraphT is a very well designed library, but takes some getting used to at > first. Edges are created using the EdgeFactors; raw Edges are not > constructed. Then the src and target are queried via the graph in which the > edge exists. > > --Rob > > On Jul 11, 2011 11:59 AM, "Anant Rathi" <ar...@21...> wrote: >> All, >> >> org.jgrapht.graph.DefaultEdge has protected getSource() and getTarget() >> methods, but there aren't setters for source and target or a constructor >> that sets them. Whether you are instantiating or extending DefaultEdge, the >> source and target members can't be modified, and they're always null. That >> doesn't seem right. >> >> Am I missing something? >> >> Anant Rathi >> Research Intern >> 21st Century Technologies, Inc. >> 6011 W. courtyard Drive >> Building 5, Suite 300 >> Austin, TX 78730 >> >> Phone: 512 682 4707 >> Email: ar...@21... >> URL: http://www.21technologies.com >> >> The information in this email and in any attachments is confidential and >> may be privileged. If you are not the intended recipient, please destroy >> this message, delete any copies held on your systems and notify the sender >> immediately. You should not retain, copy or use this email for any purpose, >> nor disclose all or any part of its content to any other pserson. >> > > > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2d-c2 > _______________________________________________ > jgrapht-users mailing list > jgr...@li... > https://lists.sourceforge.net/lists/listinfo/jgrapht-users > > |