Package primitives.graph

Examples of primitives.graph.Graph


    }

    return new ClusterHead(g);
        }
  public static ClusterHead loadTreeFromDotS(String input) {
    Graph g = new Graph();
    String[] lines = input.split("\r\n|\r|\n");
    HashMap<String, Node> nodes = new HashMap<String, Node>();

    for (String line : lines) {
      if (line.matches("^\\W*#.*$"))
        continue;
      Matcher m = definitionLine.matcher(line);
      if (m.matches()) {
        Matcher m2 = transitionLine.matcher(line);
        if (m2.matches()) {
          String s1 = m2.group(1);
          String s2 = m2.group(2);
          // String s3 = m2.group(3);
          nodes.put(s1, new Node(s1));
          nodes.put(s2, new Node(s2));
        } else {
          String s1 = m.group(1);
          nodes.put(s1, new Node(s1));
        }
      } else {

      }
    }

    for (String k : nodes.keySet()) {
      g.addNode(nodes.get(k));
    }

    for (String line : lines) {
      Matcher m2 = transitionLine.matcher(line);
      if (m2.matches()) {
View Full Code Here


    public ClusterHead(Set<IClusterLevel> ch, boolean IGNORED) {
        setChildren(ch);
    }

    public ClusterHead deepCopy() {
        ClusterHead newMe = new ClusterHead(new Graph());
        for (IClusterLevel c : newMe.getChildren()) {
            newMe.deleteChild(c);
        }

        Set<Node> oldNodes = getNodes();
View Full Code Here

    }
    return g;
  }
 
  public static Graph stripReflexiveEdges(String filename) throws IOException{
    return new Graph(TreeLoader.loadTreeFromDot(filename).getNodes());
  }
View Full Code Here

    public BunchTurboMQFitnessFunctionTest() {
    }
   
    @Before
    public void setUp() {
        Graph g = new Graph();
        g.addNode(new Node("node 1"));
        g.addNode(new Node("node 2"));
        g.addNode(new Node("node 3"));
        for(Node n : g.getNodes()){
            for(Node n2 : g.getNodes()){
                if(n != n2)
                    n.connect(n2, "");
            }
        }
       
        goodTree = new ClusterHead();
       
        for(Node n: g.getNodes()){
            ClusterNode cn = new ClusterNode();
            cn.addNode(n);
            goodTree.addChild(cn);
        }
       
        badTree = new ClusterHead();
       
        for(Node n: g.getNodes()){
            ClusterNode cn = new ClusterNode();
            cn.addNode(n);
            badTree.addChild(cn);
        }
        ClusterNode dummy = new ClusterNode();
View Full Code Here

TOP

Related Classes of primitives.graph.Graph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.