private static void printme(RootGraph root, GraphPerspective persp) { System.out.println("in RootGraph: " + root.getNodeCount() + " nodes and " + root.getEdgeCount() + " edges"); System.out.println("in GraphPerspective: " + persp.getNodeCount() + " nodes and " + persp.getEdgeCount() + " edges"); System.out.println(); }
/** * DOCUMENT ME! * * @param args DOCUMENT ME! */ public static void main(String[] args) { final RootGraph root = FingRootGraphFactory.instantiateRootGraph(); final int[] nodeInx = root.createNodes(10000); final int[] edgeInx = new int[100000]; for (int i = 0; i < edgeInx.length; i++) edgeInx[i] = root.createEdge(nodeInx[i % nodeInx.length], nodeInx[(i * 3) % nodeInx.length]); System.out.println("RootGraph node count: " + root.getNodeCount()); System.out.println("RootGraph edge count: " + root.getEdgeCount()); System.out.println(); for (int i = 0; i < 1000; i++) { GraphPerspective persp = root.createGraphPerspective(nodeInx, edgeInx); System.out.println("GraphPerspective node count: " + persp.getNodeCount()); System.out.println("GraphPerspective edge count: " + persp.getEdgeCount()); System.out.println(); } } }
/** * DOCUMENT ME! * * @param args DOCUMENT ME! */ public static void main(String[] args) { final RootGraph root = FingRootGraphFactory.instantiateRootGraph(); final int n1 = root.createNode(); final int n2 = root.createNode(); final int e1 = root.createEdge(n1, n1, /* directed */ true); final GraphPerspective persp = root.createGraphPerspective((int[]) null, (int[]) null); if (persp.restoreEdge(e1) == 0) throw new IllegalStateException("could not restore valid edge"); final GraphPerspective persp2 = root.createGraphPerspective(null, new int[] { e1 }); if (!((persp2.getNodeCount() == 1) && (persp2.getEdgeCount() == 1))) throw new IllegalStateException("bad counts in perspective"); } }
|| (persp2.getEdgeCount() != persp.getEdgeCount())) throw new IllegalStateException("clone has different topology"); if (persp2.getEdgeCount() != 0) throw new IllegalStateException("some edges in clone remaining"); if ((persp2.getNodeCount() != 0) || (persp2.getEdgeCount() != 0)) throw new IllegalStateException("nodes or edges remaining"); if (persp.getEdgeCount() != 7) throw new IllegalStateException("wrong number of edges"); if (persp.getEdgeCount(persp.getNode(nodeInx[0]), persp.getNode(nodeInx[1]), true) != 1) throw new IllegalStateException("wrong number in edge count"); if ((persp.getEdgeCount(persp.getNode(nodeInx[0]), root2Node, true) != -1) || (persp.getEdgeCount(persp.getNode(nodeInx[1]), nodeNotInPersp, false) != -1)) throw new IllegalStateException("edge count not -1"); if (persp.getEdgeCount(persp.getNode(nodeInx[1]), persp.getNode(nodeInx[1]), false) != 0) throw new IllegalStateException("edge count not 0"); if (persp.getEdgeCount(nodeInx[3], nodeInx[2], true) != 1) throw new IllegalStateException("edge count not 1"); if (persp.getEdgeCount(nodeInx[2], nodeInx[3], true) != 0) throw new IllegalStateException("edge count not 0"); if (persp.getEdgeCount(nodeInx[1], nodeInx[2], false) != 0)
throw new IllegalStateException("GraphPerspective does not have two nodes"); if (root.createGraphPerspective(null, twoEdges).getEdgeCount() != 2) throw new IllegalStateException("GraphPerspective does not have two edges"); throw new IllegalStateException("GraphPerspective has less than two nodes"); if (root.createGraphPerspective(twoNodes, twoEdges).getEdgeCount() < 2) throw new IllegalStateException("GraphPerspective has less than two edges"); throw new IllegalStateException("GraphPerspective does not have two nodes"); if (root.createGraphPerspective(null, twoEdgeInx).getEdgeCount() != 2) throw new IllegalStateException("GraphPerspective does not have two edges"); throw new IllegalStateException("GraphPerspective has less than two nodes"); if (root.createGraphPerspective(twoNodeInx, twoEdgeInx).getEdgeCount() < 2) throw new IllegalStateException("GraphPerspective has less than two edges");