Git Product home page Git Product logo

Comments (1)

KevinMarquette avatar KevinMarquette commented on June 12, 2024

Ok, I have this working now with that syntax. Here is the DOT output:

digraph g {
    compound="true";
    subgraph clusterSource {
        "Source" [label="";style="invis";shape="point";]
        "a" 
    }
    "b" 
    "Source"->"b" [ltail="clusterSource";]
}

With this change, I am injecting in a lot of more DOT instructions.
The subgraph needs to be prefixed with cluster and I was already doing that. I am now injecting a node that matches the name the user gives to the subgraph. This node is small and invisible.

The purpose of this node is so that we can use the name of the subgraph in the edge definition. The user thinks it is pointing to their subgraph but it is really pointing to this invisible node.

To get the line to start or stop at the edge of a subgraph, we need to use the compound="true"; on the base graph with the ltail or 'lhead' attributes on the edge. This does need to match the name of the subgraph.

To do this, I keep a master list of subgraphs created. Whenever an edge is drawn to a subgraph, I use this master list to detect it and inject the needed attributes. This look-up has to happen for every edge connection.

We may see a performance impact from this change as the attributes were preprocessed for an entire list of edges but now I have to do this processing for each edge. Should only be noticeable for large datasets.

from psgraph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.