All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sdmlib.models.pattern.IsomorphismComputation Maven / Gradle / Ivy

Go to download

SDMLib is a light weight modeling library. SDMLib intentionally comes without any tool or editor.

There is a newer version: 2.3.2341
Show newest version
package org.sdmlib.models.pattern;

import java.util.LinkedHashMap;

import de.uniks.networkparser.IdMap;

public class IsomorphismComputation
{

   public static LinkedHashMap calculateMatch(Object graph1, Object graph2, IdMap creators)
   {
      IdMap map1 = new IdMap().withSessionId("s").with(creators);
      IdMap map2 = new IdMap().withSessionId("s").with(creators);

      ReachableState rs1 = new ReachableState().withGraphRoot(graph1);
      ReachableState rs2 = new ReachableState().withGraphRoot(graph2);

      String s1cert = rs1.computeCertificate(map1);
      String s2cert = rs2.computeCertificate(map2);

      ReachabilityGraph reachabilityGraph = new ReachabilityGraph();
      reachabilityGraph.setMasterMap( new IdMap().withSessionId("s").with(creators));

      return reachabilityGraph.match(rs1, rs2);
   }

   public static boolean isIsomorphic(Object graph1, Object graph2, IdMap creators)
   {
      return calculateMatch(graph1, graph2, creators) != null;
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy