Examples of GraphNode


Examples of adt.graph.GraphNode

import adt.graph.GraphNode;

public class Q003A_Clone_Graph_DFS {

  public static void main(String[] args) {
    GraphNode n0 = new GraphNode(0);
    GraphNode n1 = new GraphNode(1);
    GraphNode n2 = new GraphNode(2);
    GraphNode n3 = new GraphNode(3);
    GraphNode n4 = new GraphNode(4);
    GraphNode n5 = new GraphNode(5);
    GraphNode n6 = new GraphNode(6);
    GraphNode n7 = new GraphNode(7);
    GraphNode n8 = new GraphNode(8);
   
    n0.addNeighbors(new GraphNode[]{n1, n7});
    n1.addNeighbors(new GraphNode[]{n0, n2, n7});
    n2.addNeighbors(new GraphNode[]{n1, n3, n5, n8});
    n3.addNeighbors(new GraphNode[]{n2, n4, n5});
    n4.addNeighbors(new GraphNode[]{n3, n5});
    n5.addNeighbors(new GraphNode[]{n2, n3, n4, n6});
    n6.addNeighbors(new GraphNode[]{n5, n7, n8});
    n7.addNeighbors(new GraphNode[]{n0, n1, n6, n8});
    n8.addNeighbors(new GraphNode[]{n2, n6, n7});
   
    n0.printDFS();
   
    GraphNode copy1 = cloneGraph(n0, new HashMap<GraphNode, GraphNode>());
    copy1.printDFS();
   
    GraphNode copy2 = cloneGraph(n0);
    copy2.printDFS();
  }
View Full Code Here

Examples of br.usp.each.saeg.bytecode.analysis.graph.GraphNode

       
        if (frames[i] != null) {
         
          final AbstractInsnNode instruction = instructions[i];
         
          final GraphNode node = new GraphNode(i);
         
          node.instructions.add(new BytecodeInstruction(instruction));
         
          nodes.put(node.id, node);
        }
View Full Code Here

Examples of com.google.devtools.depan.model.GraphNode

    return graphBuilder.mapNode(orphan);
  }

  @Override
  public void newDep(GraphNode parent, GraphNode child, Relation t) {
    GraphNode p = graphBuilder.mapNode(parent);
    GraphNode c = graphBuilder.mapNode(child);

    graphBuilder.addEdge(new GraphEdge(p, c, t));
  }
View Full Code Here

Examples of edu.mit.csail.sdg.alloy4graph.GraphNode

   public static JPanel produceGraph(AlloyInstance instance, VizState view, AlloyProjection proj) throws ErrorFatal {
      view = new VizState(view);
      if (proj == null) proj = new AlloyProjection();
      Graph graph = new Graph(view.getFontSize() / 12.0D);
      new StaticGraphMaker(graph, instance, view, proj);
      if (graph.nodes.size()==0) new GraphNode(graph, "", "Due to your theme settings, every atom is hidden.", "Please click Theme and adjust your settings.");
      return new GraphViewer(graph);
   }
View Full Code Here

Examples of gannuWSD.graphs.GraphNode

        double w=0.0d;
        double m=0.0d;
        ArrayList<String> dwords=new ArrayList<String>();
        for(Sense s:relevantSynsets)
        {
          GraphNode gn=g.get(s, depth, relations);
          if(gn!=null)
          {
            dwords.add(s.getSynonyms().get(0));
            m+=1.0d;
          }              
View Full Code Here

Examples of org.apache.clerezza.rdf.utils.GraphNode

    Lock lock = existingNode.writeLock();
    try {
      lock.lock();
      for (FeatureStructure uimaObject : uimaObjects) {
        // create a new node for the current Annotation
        GraphNode annotationNode = new GraphNode(new UriRef(new StringBuilder(ENTITY.Annotation.getUnicodeString()).
                append(uimaObject.hashCode()).toString()), existingNode.getGraph());
        log.info(new StringBuilder("Node created for Type ").append(uimaObject.getType().toString()).toString());

        // set Annotation specific properties for the node
        if (uimaObject instanceof Annotation) {
          Annotation annotation = (Annotation) uimaObject;
          String coveredText = annotation.getCoveredText();
          annotationNode.addPropertyValue(ENTITY.coveredText, coveredText);
          log.info(new StringBuilder("Node wraps Annotation with coveredText:").append(coveredText).toString());
        }

        //XXX : in OpenCalais the type is an URI so it maybe reasonable to put another node here
        annotationNode.addPropertyValue(ENTITY.uimaType, uimaObject.getType().getName());

        /* inspect features of the annotation */
        Type type = uimaObject.getType();
        for (Feature feature : type.getFeatures()) {

          // create a new feature node
          GraphNode featureNode = new GraphNode(new UriRef(new StringBuilder(ENTITY.Feature.getUnicodeString()).
                  append(feature.hashCode() / uimaObject.hashCode()).toString()), annotationNode.getGraph());
          log.info(new StringBuilder("Node created for Feature ").append(feature.getName()).toString());

          // set feature name and value if not null
          featureNode.addPropertyValue(ENTITY.featureName, feature.getName());

          String featureValue = null;
          try {
            featureValue = uimaObject.getFeatureValueAsString(feature);
          } catch (CASRuntimeException sofaEx) {
            try {
              // this is usually due to Sofa having a range of {2}
              featureValue = uimaObject.getFeatureValue(feature).toString();
            } catch (Exception ex) {
              // do nothing at the moment
              log.warn(new StringBuilder("Unable to create feature value - ").append(ex.toString()).append(" (").
                      append(sofaEx.toString()).append(")").toString());
            }
          }

          if (featureValue != null) {
            featureNode.addPropertyValue(ENTITY.featureValue, featureValue);
            log.info(new StringBuilder("Added feature ").append(feature.getName()).append(" with value ")
                    .append(featureValue.toString()).toString());
          }

          // add feature to the annotation node
          annotationNode.addProperty(ENTITY.hasFeature, featureNode.getNode());
        }

        // finally add the triple to the existing node
        existingNode.addProperty(ENTITY.contains, annotationNode.getNode());

View Full Code Here

Examples of org.apache.clerezza.rdf.utils.GraphNode

  private void testWithFiles(String triples, String template, String expected)
      throws Exception {
    TripleCollection tc = Parser.getInstance().parse(
        getClass().getResourceAsStream(triples),
        "text/turtle");
    GraphNode res = new GraphNode(root, tc);
    ByteArrayOutputStream baosRendered = new ByteArrayOutputStream();
    renderlet.render(res, null, null, null,
        getClass().getResource(template).toURI(),
        null, null, null, baosRendered);
    ByteArrayOutputStream baosExpected = new ByteArrayOutputStream();
View Full Code Here

Examples of org.apache.clerezza.rdf.utils.GraphNode

    public Object getDescription(@Context UriInfo uriInfo){
      String absoluteUriPath = uriInfo.getAbsolutePath().toString();
      MGraph contentMGraph = tcManager.getMGraph(Constants.CONTENT_GRAPH_URI);
        UriRef uri = new UriRef(absoluteUriPath.substring(0,
            absoluteUriPath.length() - DESCRIPTION_SUFFIX.length()));
        GraphNode graphNode = new GraphNode(uri, contentMGraph);
        return graphNode.getNodeContext();
    }
View Full Code Here

Examples of org.apache.clerezza.rdf.utils.GraphNode

    });
    final Iterator<Resource> entriesIter = titledContent.getObjects(DISCOBITS.contains);
    while (entriesIter.hasNext()) {
      Resource resource = entriesIter.next();
      entries.add(new GraphNode((NonLiteral) resource,titledContent.getGraph()));
    }
    final List<GraphNode> result = new ArrayList<GraphNode>();
    for (GraphNode graphNode : entries) {
      Iterator<Resource> holded = graphNode.getObjects(DISCOBITS.holds);
      if (!holded.hasNext()) {
        throw new RuntimeException(
            "Titled Content must contain a first element: "+graphNode.getNodeContext());
      }
      result.add(new GraphNode(holded.next(),
          titledContent.getGraph()));
    }
    return result;
  }
View Full Code Here

Examples of org.apache.clerezza.rdf.utils.GraphNode

  private class RenderFunction implements RenderingFunction<Object, String> {

    @Override
    public String process(Object... values) throws IOException {
      NonLiteral resource = (NonLiteral) values[0];
      GraphNode graphNode = new GraphNode(resource, graph);
      String mode = null;
      if (values.length > 1) {
        mode = (String) values[1];
      }
      ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.