Joey is correct. The issue is that the adjacency matrix does not make new edges -- the edges it's constructed of are the same edges that are owned by (in your case) softRestartSocialNetwork. You're trying to also use them in consumerSocialNetwork, which is a no-no. And Joey is right that you can just use the copy-constructor.
Sean
On Jul 17, 2012, at 3:06 PM, Joey Harrison wrote:
> Hey Russell,
>
> I just took a look at the MASON code and I think I know what's happening. First, note the following from Edge.java:
>
> // to prevent edges from breaking fields by being stored in two different fields.
> // if null, then no owner -- the Edge is free to be added to a field.
> Network owner;
>
> Then, in Network.addEdge(final Edge edge):
>
> if (edge.owner!=null)
> throw new RuntimeException("Attempted to add an Edge already added elsewhere");
>
> When you created the network the first time, each of your edge's had their owner variable set. You can't really reuse edges like that, but I think you can use the copy constructor like so:
>
> consumerSocialNetwork.addEdge(new Edge(e[i][j]));
>
> Good luck,
> Joey
>
> On Tue, Jul 17, 2012 at 3:02 PM, Joey Harrison <[log in to unmask]> wrote:
> Hey Russell,
>
> I just took a look at the MASON code and I think I know what's happening. First, note the following from Edge.java:
>
> // to prevent edges from breaking fields by being stored in two different fields.
> // if null, then no owner -- the Edge is free to be added to a field.
> Network owner;
>
> Then, in Network.addEdge(final Edge edge):
>
> if (edge.owner!=null)
> throw new RuntimeException("Attempted to add an Edge already added elsewhere");
>
> When you created the network the first time, each of your edge's had their owner variable set. You can't really reuse edges like that, but I think you can use the copy constructor like so:
>
> consumerSocialNetwork.addEdge(new Edge(e[i][j]));
>
> Good luck,
> Joey
>
|