Examples of DirectedGraph


Examples of com.sparc.knappsack.models.reports.DirectedGraph

    @Autowired(required = true)
    private OrganizationService organizationService;

    public DirectedGraph createGraphForOrganization(Long organizationId) {
        DirectedGraph data = new DirectedGraph();

        List<Node> nodes = new ArrayList<Node>();
        List<Link> links = new ArrayList<Link>();
        Organization organization = organizationService.get(organizationId);

        Node rootNode = new Node();
        rootNode.setType("organization");
        rootNode.setId(Long.toString(organizationId));
        rootNode.setUuid(organization.getUuid());
        rootNode.setMatch(Float.toString(generator.nextFloat() * 1.0f));
        rootNode.setName(organization.getName());
        rootNode.setPopularity(Long.toString(organization.getUserDomains().size()));
        nodes.add(rootNode);

        addGroupNodes(nodes, links, organization);

        data.setNodes(nodes);
        data.setLinks(links);

        return data;
    }
View Full Code Here

Examples of com.sparc.knappsack.models.reports.DirectedGraph

        return data;
    }

    public DirectedGraph createGraphForAllAdministeredOrganizations() {
        DirectedGraph data = new DirectedGraph();

        List<Node> nodes = new ArrayList<Node>();
        List<Link> links = new ArrayList<Link>();
        List<Organization> organizations = userService.getAdministeredOrganizations(userService.getUserFromSecurityContext(), SortOrder.ASCENDING);

        Node rootNode = new Node();
        rootNode.setType("root");
        rootNode.setId("0");
        rootNode.setUuid(UUID.randomUUID().toString());
        rootNode.setMatch(Float.toString(generator.nextFloat() * 1.0f));
        rootNode.setName("Root Node");
        rootNode.setPopularity(Long.toString(organizations.size()));
        nodes.add(rootNode);

        addOrganizationNodes(rootNode, nodes, links, organizations);

        data.setNodes(nodes);
        data.setLinks(links);

        return data;
    }
View Full Code Here

Examples of de.hpi.bpt.graph.DirectedGraph

    Map<String, Map<String, Object>> idMap = mec.getIdMap();
    Map<String, ArcModel> arcMap = mec.getArcMap();
   
    Map<String, Vertex> idToVertex = new HashMap<String, Vertex>();
   
    DirectedGraph g = new DirectedGraph();
   
    for(String key:idMap.keySet()){
      Vertex s = new Vertex(key);
      g.addVertex(s);
      idToVertex.put(key, s);
    }
     
   
    for(String key:idMap.keySet()){
      for(String subkey:idMap.get(key).keySet()){
        ArcModel arc = arcMap.get(subkey);
        if(arc == null) continue;
        g.addEdge(idToVertex.get(arc.getSourceId()), idToVertex.get(arc.getTargetId()));
      }
    }
   
    rpst = new RPST<DirectedEdge,Vertex>(g);
   
View Full Code Here

Examples of org._3pq.jgrapht.DirectedGraph

   */
  public Set<String> listCycles() {
    /*
     * convert nodeRefs datastructure to a directed graph
     */
    DirectedGraph dg = new DefaultDirectedGraph();
    DirectedEdgeFactory def = new EdgeFactories.DirectedEdgeFactory();
    /*
     * add the course structure as directed graph, where
     */
    Visitor v = new Convert2DGVisitor(dg);
    (new TreeVisitor(v, cetm.getRootNode(), true)).visitAll();
    /*
     * iterate over nodeRefs, add each not existing node id as vertex, for each
     * key - child relation add an edge to the directed graph.
     */
    Iterator<String> keys = nodeRefs.keySet().iterator();
    while(keys.hasNext()) {
      //a node
      String key = keys.next();
      if(!dg.containsVertex(key)) {
        dg.addVertex(key);
      }
      //and its children
      Set<String> children = nodeRefs.get(key);
      Iterator<String> childrenIt = children.iterator();
      while(childrenIt.hasNext()){
        String child = childrenIt.next();
        if(!dg.containsVertex(child)) {
          dg.addVertex(child);
        }
        //add edge, precondition: vertex key - child are already added to the graph
        Edge de = def.createEdge(key, child);
        dg.addEdge(de);
      }
    }
    /*
     * find the id's participating in the cycle, and return the intersection
     * with set of id's which actually produce references.
View Full Code Here

Examples of org.eclipse.draw2d.graph.DirectedGraph

    }

    private void execute() {
        editor.doSave(null);
        Map<Long, Node> mapping = new HashMap<Long, Node>();
        DirectedGraph graph = createDirectedGraph(mapping);
        DirectedGraphLayout layout = new DirectedGraphLayout();
        layout.visit(graph);
        for (Map.Entry<Long, Node> entry: mapping.entrySet()) {
            Node node = entry.getValue();
            DefaultElementWrapper elementWrapper = (DefaultElementWrapper)
View Full Code Here

Examples of org.eclipse.draw2d.graph.DirectedGraph

        // TODO: implement changes as a command, so we can support undo
        editor.doSave(null);
    }
   
    protected DirectedGraph createDirectedGraph(Map<Long, Node> mapping) {
        DirectedGraph graph = new DirectedGraph();
        WorkflowProcess process = (WorkflowProcess) ((ProcessWrapper) ((GenericModelEditor) editor).getModel()).getProcess();
        for (org.kie.definition.process.Node processNode: process.getNodes()) {
            Node node = new Node();
            Integer width = (Integer) processNode.getMetaData().get("width");
            Integer height = (Integer) processNode.getMetaData().get("height");
View Full Code Here

Examples of org.eclipse.draw2d.graph.DirectedGraph

    }

    private void execute() {
        editor.doSave(null);
        Map<Long, Node> mapping = new HashMap<Long, Node>();
        DirectedGraph graph = createDirectedGraph(mapping);
        DirectedGraphLayout layout = new DirectedGraphLayout();
        layout.visit(graph);
        for (Map.Entry<Long, Node> entry: mapping.entrySet()) {
            Node node = entry.getValue();
            DefaultElementWrapper elementWrapper = (DefaultElementWrapper)
View Full Code Here

Examples of org.eclipse.draw2d.graph.DirectedGraph

        editor.doSave(null);
    }
   
    @SuppressWarnings("unchecked")
    protected DirectedGraph createDirectedGraph(Map<Long, Node> mapping) {
        DirectedGraph graph = new DirectedGraph();
        WorkflowProcess process = (WorkflowProcess) ((ProcessWrapper) ((GenericModelEditor) editor).getModel()).getProcess();
        for (org.kie.api.definition.process.Node processNode: process.getNodes()) {
            Node node = new Node();
            Integer width = (Integer) processNode.getMetaData().get("width");
            Integer height = (Integer) processNode.getMetaData().get("height");
View Full Code Here

Examples of org.eclipse.draw2d.graph.DirectedGraph

    private Map<AbstractGraphicalEditPart, Object> partToNodesMap;
    private DirectedGraph graph;

    public void layoutDiagram(ProcessEditPart diagram) {
        partToNodesMap = new HashMap<AbstractGraphicalEditPart, Object>();
        graph = new DirectedGraph();
        addNodes(diagram);
        if (graph.nodes.size() > 0) {
            addEdges(diagram);
            new DirectedGraphLayout().visit(graph);
            applyResults(diagram);
View Full Code Here

Examples of org.eclipse.draw2d.graph.DirectedGraph

    super(styles);
  }

  protected void applyLayoutInternal(InternalNode[] entitiesToLayout, InternalRelationship[] relationshipsToConsider, double boundsX, double boundsY, double boundsWidth, double boundsHeight) {
    HashMap mapping = new HashMap(entitiesToLayout.length);
    DirectedGraph graph = new DirectedGraph();
    for (int i = 0; i < entitiesToLayout.length; i++) {
      InternalNode internalNode = entitiesToLayout[i];
      Node node = new Node(internalNode);
      node.setSize(new Dimension(10, 10));
      mapping.put(internalNode, node);
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.