Git Product home page Git Product logo

asciinet's Introduction

asciinet

asciinet is a wrapper over the ascii-graphs library for printing networkx graphs as ASCII.

Important Notes

This software is the product of research carried out at the University of Zurich and comes with no warranty whatsoever. Have fun!

TODO's

  • The project is not documented (yet)

How to Install the Project

First make sure java is installed on your system. To install asciinet follow these instructions:

$ git clone https://github.com/cosminbasca/asciinet
$ cd asciinet/pyasciinet
$ python setup.py install

Also have a look at the build.sh script included in the codebase for a complete setup of the build process

Example

import networkx as nx
from asciinet import graph_to_ascii

#
# create a simple graph
#
G = nx.Graph()
G.add_node(1)
G.add_nodes_from([2, 3, 4])
G.add_edges_from([(1, 2), (1, 3), (3, 4), (1, 4), (2, 4)])

#
# should print
#  ┌───────┐
#  │   1   │
#  └┬────┬┬┘
#   │    ││
#   │    └┼───┐
#   v     v   │
# ┌───┐ ┌───┐ │
# │ 2 │ │ 3 │ │
# └──┬┘ └─┬─┘ │
#    │    │   │
#    │   ┌┼───┘
#    │   ││
#    v   vv
#  ┌───────┐
#  │   4   │
#  └───────┘
#
print graph_to_ascii(G)


Thanks a lot to

asciinet's People

Contributors

cosminbasca avatar digitalist avatar sperlea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

asciinet's Issues

Unconnected graphs are not drawn

Hi,

Thanks for the nice library! I did find one issue though: graphs with only unconnected vertices are not drawn. The simplest case (below) yields ''. Graphs with both connected and unconnected vertices do get drawn ok though.

import networkx as nx
from asciinet import graph_to_ascii

G = nx.Graph()
G.add_node(1)
assert graph_to_ascii(G) != ''

Release to PyPI?

Nice library! Would you release to PyPI so that users can simply pip install and other projects can specify as dependency?

Documentation?

Looking to add node data to graphs. Any plans on showing how to do this?

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.