Help with converting a JUNG network into a REPAST network

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

Help with converting a JUNG network into a REPAST network

Van Parunak
I'm loading a graphml file via the JUNG libraries, and now want to use
it as a network projection in a REPAST context. I naively thought that
the constructor repast.simphony.context.space.graph.ContextJungNetwork
would do this for me, if I just fed it my JUNG network and my REPAST
context, but REPAST complains,

> edu.uci.ics.jung.graph.UndirectedSparseGraph cannot be cast to
> repast.simphony.space.graph.JungNetwork
Is there a simple way to convert what I get from JUNG into REPAST? Or do
I need to set up an empty REPAST network, and then iterate over the
nodes and edges in the JUNG network and add them one by one to the
REPAST network?



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Help with converting a JUNG network into a REPAST network

srcnick
I’m not sure this will work, but you need to mimic this code:

if (isDirected) {
      net = new ContextJungNetwork<T>(new DirectedJungNetwork<T>(name, edgeCreator), context);
    } else {
      net = new ContextJungNetwork<T>(new UndirectedJungNetwork<T>(name, edgeCreator), context);
    }
context.addProjection(net);

But create the *JungNetwork separately so you can call setGraph() on it, passing that the jung Graph you created using the JUNG library. 

Nick


On May 22, 2017, at 12:06 PM, Van Parunak <[hidden email]> wrote:

I'm loading a graphml file via the JUNG libraries, and now want to use
it as a network projection in a REPAST context. I naively thought that
the constructor repast.simphony.context.space.graph.ContextJungNetwork
would do this for me, if I just fed it my JUNG network and my REPAST
context, but REPAST complains,

edu.uci.ics.jung.graph.UndirectedSparseGraph cannot be cast to
repast.simphony.space.graph.JungNetwork
Is there a simple way to convert what I get from JUNG into REPAST? Or do
I need to set up an empty REPAST network, and then iterate over the
nodes and edges in the JUNG network and add them one by one to the
REPAST network?



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Loading...