public TimeLagGraphWrapper(GraphWrapper graphWrapper) { if (graphWrapper == null) { throw new NullPointerException("No graph wrapper."); } TimeLagGraph graph = new TimeLagGraph(); Graph _graph = graphWrapper.getGraph(); for (Node node : _graph.getNodes()) { Node _node = node.like(node.getName() + ":0"); _node.setNodeType(node.getNodeType()); graph.addNode(_node); } for (Edge edge : _graph.getEdges()) { if (!Edges.isDirectedEdge(edge)) { throw new IllegalArgumentException(); } Node from = edge.getNode1(); Node to = edge.getNode2(); Node _from = graph.getNode(from.getName(), 1); Node _to = graph.getNode(to.getName(), 0); graph.addDirectedEdge(_from, _to); } this.graph = graph; }
public TimeLagGraph(TimeLagGraph graph) { this.graph = new EdgeListGraph(graph.getGraph()); this.maxLag = graph.getMaxLag(); this.numInitialLags = graph.getNumInitialLags(); this.lag0Nodes = graph.getLag0Nodes(); this.graph.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { getPcs().firePropertyChange(evt); } }); }