@Test public void testIsAutomorphic() { for (int n=2;n<10;n++) { UndirectedGraph<ChainVertexInterface, InterfaceEdgeInterface> g = createCnGraph(n); assertTrue(GraphUtils.isAutomorphic(g)); } for (int n=3;n<10;n++) { UndirectedGraph<ChainVertexInterface, InterfaceEdgeInterface> g = createDnGraph(n); assertTrue(GraphUtils.isAutomorphic(g)); } }
public static <V extends ChainVertexInterface,E extends InterfaceEdgeInterface> boolean isAutomorphic(UndirectedGraph<V, E> g) { Map<Integer, Map<Integer,Integer>> repVs = new HashMap<>(); for (V v: g.vertexSet()) { if (!repVs.containsKey(v.getEntityId())) { repVs.put(v.getEntityId(), getInterfaceClusterIdsForVertex(g, v)); } else { Map<Integer,Integer> content = getInterfaceClusterIdsForVertex(g, v); Map<Integer,Integer> repContent = repVs.get(v.getEntityId()); if (repContent.size() != content.size()) return false; for (Entry<Integer, Integer> entry : repContent.entrySet()) { Integer count = content.get(entry.getKey()); if (count == null) return false; if (count != entry.getValue()) return false; } } } return true; }
GraphUtils { public static <V extends ChainVertexInterface,E extends InterfaceEdgeInterface> boolean isAutomorphic(UndirectedGraph<V, E> g) { Map<Integer, Map<Integer,Integer>> repVs = new HashMap<>(); for (V v: g.vertexSet()) { if (!repVs.containsKey(v.getEntityId())) { repVs.put(v.getEntityId(), getInterfaceClusterIdsForVertex(g, v)); } else { Map<Integer,Integer> content = getInterfaceClusterIdsForVertex(g, v); Map<Integer,Integer> repContent = repVs.get(v.getEntityId()); if (repContent.size() != content.size()) return false; for (Entry<Integer, Integer> entry : repContent.entrySet()) { Integer count = content.get(entry.getKey()); if (count == null) return false; if (count != entry.getValue()) return false; } } } return true; } }
GraphUtils { public static <V extends ChainVertexInterface,E extends InterfaceEdgeInterface> boolean isAutomorphic(UndirectedGraph<V, E> g) { Map<Integer, Map<Integer,Integer>> repVs = new HashMap<>(); for (V v: g.vertexSet()) { if (!repVs.containsKey(v.getEntityId())) { repVs.put(v.getEntityId(), getInterfaceClusterIdsForVertex(g, v)); } else { Map<Integer,Integer> content = getInterfaceClusterIdsForVertex(g, v); Map<Integer,Integer> repContent = repVs.get(v.getEntityId()); if (repContent.size() != content.size()) return false; for (Entry<Integer, Integer> entry : repContent.entrySet()) { Integer count = content.get(entry.getKey()); if (count == null) return false; if (count != entry.getValue()) return false; } } } return true; }  }
GraphUtils { public static <V extends ChainVertexInterface,E extends InterfaceEdgeInterface> boolean isAutomorphic(UndirectedGraph<V, E> g) { Map<Integer, Map<Integer,Integer>> repVs = new HashMap<>(); for (V v: g.vertexSet()) { if (!repVs.containsKey(v.getEntityId())) { repVs.put(v.getEntityId(), getInterfaceClusterIdsForVertex(g, v)); } else { Map<Integer,Integer> content = getInterfaceClusterIdsForVertex(g, v); Map<Integer,Integer> repContent = repVs.get(v.getEntityId()); if (repContent.size() != content.size()) return false; for (Entry<Integer, Integer> entry : repContent.entrySet()) { Integer count = content.get(entry.getKey()); if (count == null) return false; if (count != entry.getValue()) return false; } } } return true; }  static SortedMap<Integer,Set<E>> groupIntoTypes(Set<E> edges, boolean byClusters); static int getEdgeMultiplicity(UndirectedGraph<V, E> g, int interfClusterId); static int[] getMultiplicities(List<StructureInterfaceCluster> interfaceClusters, UndirectedGraph<V,E> g); static TreeMap<Integer,Integer> getMultiplicities(UndirectedGraph<V, E> g); static TreeMap<Integer,Integer> getCycleMultiplicities(UndirectedGraph<V, E> g); static UndirectedGraph<V, E> getSubgraphWithSingleInterfaceCluster(
			UndirectedGraph<V, E> g, int interfaceClusterId); static int getNumDistinctInterfaces(UndirectedGraph<V, E> g); static SortedSet<Integer> getDistinctInterfaceClusters(UndirectedGraph<V,E> g); static SortedSet<Integer> getDistinctInterfaces(UndirectedGraph<V,E> g); static int getNumDistinctEntities(UndirectedGraph<V,E> g); static SortedSet<Integer> getDistinctEntities(UndirectedGraph<V,E> g); static int getLargestHeteroInterfaceCluster(UndirectedGraph<V, E> g); static SortedSet<Integer> getDistinctHeteromericInterfaceClusterIds(UndirectedGraph<V, E> g); static boolean isAutomorphic(UndirectedGraph<V, E> g); static boolean isIsomorphicForEntityAndEdgeType(
			UndirectedGraph<V, E> g, int entityId, int interfClusterId); static boolean isInterfClusterIsomorphicForEntities(
			UndirectedGraph<V, E> g, int interfClusterId); static String asString(UndirectedGraph<V, E> g); static String toDot(UndirectedGraph<V, E> g, String title); static boolean areAllIsologous(UndirectedGraph<V, E> g); }
GraphUtils { public static <V extends ChainVertexInterface,E extends InterfaceEdgeInterface> boolean isAutomorphic(UndirectedGraph<V, E> g) { Map<Integer, Map<Integer,Integer>> repVs = new HashMap<>(); for (V v: g.vertexSet()) { if (!repVs.containsKey(v.getEntityId())) { repVs.put(v.getEntityId(), getInterfaceClusterIdsForVertex(g, v)); } else { Map<Integer,Integer> content = getInterfaceClusterIdsForVertex(g, v); Map<Integer,Integer> repContent = repVs.get(v.getEntityId()); if (repContent.size() != content.size()) return false; for (Entry<Integer, Integer> entry : repContent.entrySet()) { Integer count = content.get(entry.getKey()); if (count == null) return false; if (count != entry.getValue()) return false; } } } return true; }  static SortedMap<Integer,Set<E>> groupIntoTypes(Set<E> edges, boolean byClusters); static int getEdgeMultiplicity(UndirectedGraph<V, E> g, int interfClusterId); static int[] getMultiplicities(List<StructureInterfaceCluster> interfaceClusters, UndirectedGraph<V,E> g); static TreeMap<Integer,Integer> getMultiplicities(UndirectedGraph<V, E> g); static TreeMap<Integer,Integer> getCycleMultiplicities(UndirectedGraph<V, E> g); static UndirectedGraph<V, E> getSubgraphWithSingleInterfaceCluster(
			UndirectedGraph<V, E> g, int interfaceClusterId); static int getNumDistinctInterfaces(UndirectedGraph<V, E> g); static SortedSet<Integer> getDistinctInterfaceClusters(UndirectedGraph<V,E> g); static SortedSet<Integer> getDistinctInterfaces(UndirectedGraph<V,E> g); static int getNumDistinctEntities(UndirectedGraph<V,E> g); static SortedSet<Integer> getDistinctEntities(UndirectedGraph<V,E> g); static int getLargestHeteroInterfaceCluster(UndirectedGraph<V, E> g); static SortedSet<Integer> getDistinctHeteromericInterfaceClusterIds(UndirectedGraph<V, E> g); static boolean isAutomorphic(UndirectedGraph<V, E> g); static boolean isIsomorphicForEntityAndEdgeType(
			UndirectedGraph<V, E> g, int entityId, int interfClusterId); static boolean isInterfClusterIsomorphicForEntities(
			UndirectedGraph<V, E> g, int interfClusterId); static String asString(UndirectedGraph<V, E> g); static String toDot(UndirectedGraph<V, E> g, String title); static boolean areAllIsologous(UndirectedGraph<V, E> g);  }