GithubHelp home page GithubHelp logo

ohz10 / dot-pp Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 1.04 MB

Small library for parsing DOT graph files into in-memory graphs & serializing graphs into DOT

License: Other

CMake 15.14% C++ 84.81% Shell 0.05%

dot-pp's Introduction

Dot++

A small library for reading DOT graph files and serializing graphs into DOT files. We support a subset of DOT when parsing:

  • we require an semicolon at the end of each line
  • we don't support subgraphs
  • we don't support position attributes
  • we will support multiple graphs per input file, your construction policy (see below) should be prepared to deal with that scenario should your input files fall into this catagory.

Graph Construction from DOT files

The DOT parser is parameterized on a client construction policy and calls into the policy as a DOT input is parsed. The following is an example construction policy:

class ConstructionPolicy {

    void createGraph(const std::string& name);
    void createDigraph(const std::string& name);

    void createVertex(const std::string& name);
    void createEdge(const std::string& vertex1, const std::string& vertex2);

    void applyGraphAttribute(
          const std::string& attributeName
        , const std::string& value);

    void applyDefaultVertexAttribute(
          const std::string& attributeName
        , const std::string& value);

    void applyVertexAttribute(
          const std::string& vertex
        , const std::string& attributeName
        , const std::string& value);

    void applyDefaultEdgeAttribute(
          const std::string& attributeName
        , const std::string& value);

    void applyEdgeAttribute(
          const std::string& vertex1
        , const std::string& vertex2
        , const std::string& attributeName
        , const std::string& value);

    void finalize();
};

The implementation of this interface deals with the specifics of the client's graph library. This policy should be prepared to handle multiple graphs in the event the input DOT file contains multiple top-level graphs.

Graph Serialization

Dot++ provides a serialization policy which can be called by client code to serialize a graph into the DOT format while visiting the graph using the specifics of the graph library. The serialization policy mirrors the construction policy above - see Dot++/SerializationPolicy.hpp for details.

Dependencies

Contributors

Austin Gilbert [email protected]

License

4-Clause BSD license, see LICENSE.md for details. Other licensing available upon request.

dot-pp's People

Contributors

ohz10 avatar

Watchers

 avatar James Cloos avatar

dot-pp's Issues

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.