18

This question is looking for a practical and easy way for drawing multigraphs using Javascript.

First of all look at this question. None of those libraries support Multigraphs (or Pseudographs ). I mean I can't generate graphs like this:

Some Multigraph

Is there any jQuery plugin (or javascript library) out there for this purpose ?

I thought i can use WolframAlpha's API and use its images, something like this:

enter image description here

but it have lots of problem:

  1. I can't move nodes or add remove edges interactively.

  2. Only 2000 API calls per month. Not enough.

  3. I can't produce large or intermediate graphs.

  4. They are really ugly!

Please help me if you know some javascript library in order to draw Multigraphs, or anyway to produce such graphs (something like Dracula Graph Library but with ability to draw Multigraphs).

4
  • Are you sure you need to make them IN javascript? Commented Nov 29, 2011 at 10:18
  • yes its needed for a website about mathematics and i want to interactively generate multigraphs from users input data. Commented Nov 29, 2011 at 10:30
  • 1
    This answer might help. Commented Jun 29, 2013 at 17:56
  • For the record, a number of the libraries listed in the question linked do support multigraphs, at least now. Commented Feb 15, 2021 at 23:33

10 Answers 10

12

Cytoscape.JS supports multigraphs, is pure Javascript, and uses the new HTML 5 Canvas for performance. Its design intent is general purpose graph visualization/manipulation.

https://js.cytoscape.org/

Sign up to request clarification or add additional context in comments.

Comments

5

If you are allowed to use Google Charts API you may refer to this

http://code.google.com/apis/chart/image/docs/gallery/graphviz.html

Example:

https://chart.googleapis.com/chart?cht=gv&chl=graph{C_0--H_0[type=s];C_0--H_1[type=s];C_0--H_2[type=s];C_0--C_1[type=s];C_1--H_3[type=s];C_1--H_4[type=s];C_1--H_5[type=s]}

graph

1 Comment

@parashant-bhate: great suggestion. it supports Multigraphs too. It will be perfect if I could make it more interactive. Like click over nodes in order to delete them or move node or delete edges by clicking over them. thanks again
3

I'm affraid you will have to do some development yourself. Raphael.js is pretty capable in creating and manipulating svg - would be good starting point

Comments

3

Some of those graph visualization libraries (mentioned in this question) DO support Multigraphs and allow dragging/placement of nodes

jsplumb: http://jsplumb.org/jquery/stateMachineDemo.html

possibly http://js-graph-it.sourceforge.net/ may support multigraphs.

but as far as your issue

4- Its really ugly!

These may not appeal to your aesthetic.

Comments

2

I think paper.js (http://paperjs.org) will get you also pretty close.

Comments

2

You might want to check this one out: www.d3js.org

You'd have to do a lot yourself (make your own SVG and such), but the library is very powerful.

Comments

1

I recently used Graphviz to draw the connections between some authors pubblications. Graphviz is open source graph visualization software. The Graphviz layout programs take descriptions of graphs in a simple text language, and make diagrams in useful formats, such as images and SVG for web pages, PDF or Postscript for inclusion in other documents; or display in an interactive graph browser.

For example i used a simple DOT file to write all the connection between the authors and I produced a PNG file.

http://www.graphviz.org/

Here there is all the documentation that you need and in the gallery section you can see a lot of output example.

Hoping it could be helpful.

1 Comment

thanks, but i want interactivity generate graphs via user input in my webpage.
1

In a commercial scenario, take a look at yFiles for HTML:

It easily supports multi-graphs and does not look too ugly, I believe:

Multi-graphs - laid out automatically using yFiles for HTML

(These graphs have been laid out automatically, manual placement is also possible.)

Of course this is a matter of taste, so if you don't like the look, you can change any aspect of the visualization, like in the style tutorial.

The API offers full interactive editing capabilities and being a pure client-side solution, of course there is no API call count limit.

Large graphs are still a problem with todays' Javascript engines, but only if "large" means more than thousands of elements. With virtualization (considering only what is currently visible in the viewport during rendering), you can get good performance with thousands of elements.

Disclaimer: I work for the company that creates the library, on SO/SE, however I do not represent my employer. My posts and comments are my own.

Comments

1

You can check jsnetworkx (http://jsnetworkx.org/)

It is a js version of python graph library which supports multi-graph. It has a draw function which visualizes the graph using D3.js. It is available for both browser and node.js.

Comments

0

Best bet would be to render them on the server (or use it as an applet) with JGraphT.

3 Comments

i want a "javascipt" library ... JGraphT is a Java library.
I know, but there are no javascript libraries for that. As you already pointed out that you might just wanted to use Wolfram API which spits out images, this could be a viable solution.
I don't know why I'm insist not to use flash or applets ... now I'm working on @Konstantin's solution and do the development by myself. Of course after finishing development I'll make it fully open source. Thanks anyway.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.