I have tabular data with the following fields constituting a record:
SourceID
SourceLabel
SourceGroupID
TargetID
TargetLabel
TargetGroupID
I would like to convert this data to graphviz DOT format either programmatically or as part of a script. In particular, I would like to cluster nodes according to their GroupID.
This seems like it would be a common task--are there existing tools / code (preferably Python or R) examples that do this?
It sounds like the NetworkX library for Python might do what you want. What you need to do is read in an edge list (see networkx.readwrite.edgelist), process it to create the groups or anything else you need, and write out the Graphvis dot file (see networkx.drawing.nx_pydot.write_dot).
NetworkX can do other graph visualizations on its own without Graphvis (gallery, docs), and can export many other formats including GraphML. There are tons of open source tools to visualize graphs that can import GraphML, like
NodeXL, a great introductory tool that integrates network analysis into Excel 2007/2010 (Disclaimer: I'm an advisor for it). Other awesome tools include Gephi and Cytoscape, while Pajek and UCINet are some proprietary alternatives.
Related
I really like a lot of the features of Sphinx, but I also require the final output to be docx. I've had great luck with .rst -> .odt -> .docx using rst2odt.py (docutils) and LibreOffice. I noticed that Sphinx can generate "Docutils XML". In my mind, I should be able to use that and then go to .odt through the same mechanism as rst2odt.py does. However, I'm not sure how I would go about that. I realize that there is a package sphinxcontrib-docxbuilder, but it uses python-docx internally which has rather limited table support based on my experiments. I am using rst specifically because of the ability to do column/row spanning in a very clean way.
The alternative that I'm currently considering is to use something like jinja2 to do all the stuff I would need Sphinx for and stick stick with rst2odt.py.
I am currently using Neo4j Python rest client and I would like to visualise the graph and be able to amend it, add new nodes relationships etc. Also I would like the changes in the neo4j database as well. Is that possible? Also can self-loops be visualised? I have read about D3.js and Neoclipse and Gephi in http://www.neo4j.org/develop/visualize but I am not sure which one to use.
Thanks in advance.
You can manipulate the graph in Neo4J using Cypher, in particular using a the REST API.
Any kind of tool that allows you to interface with Cypher is potentially able to do what you are asking: it is a matter to combine some Cypher queries with the GUI.
Said that, create the right visualization for what you are doing might be tricky and general approach might no satisfy your needs: while Neoclipse can let you manipulate nodes and links in Neo4J (for free) you might want to do in a particular way (for example restricting the choice of editing or the field/properties to be changed).
Linkurious offers a solution to do that as well, but it's a commercial license.
Other solutions such KeyLines, d3.js, sigmaJS let you personalize that experience: note that they will require to create the interface yourself, but the result will be much better in case of a specific product IMHO.
So value your time and requirements and go with the proper solution.
For more tools have a look at the Neo4J visualization page: http://www.neo4j.org/develop/visualize
About self loops:
that's a tricky bit and there is not a right way to do those - imagine a scenario with hunders of multi-selfloops.
Personally I would recommend to NOT draw them on the chart as link/edges, while representing them in some other ways: es. glyphs, notes, bubbles on the node...
I believe the only tool that allows this today is Neoclipse, but I don't think it's updated to use the Labels and Indexing features released in 2.0.
As such, your best bet will be using the Neo4j Browser to visualize and Cypher to mutate your graph. If you want richer functionality and want a fun project to hack on, it shouldn't be super hard to build a basic visualization for Neo that allows mutating the graph. I would have a look at sigma.js: http://linkurio.us/sigma-js-1-0-next-gen-graph-drawing-lib-web/
I have a wellformatted excel file with a lot of macros and styling in it that I want to keep.
Then i have this information I want to enter in the file.
And I want to do it with ruby.
I've tried roo and spreadsheet but they don't seem able to actually edit the file, just create a new one and loosing all the formattin in the process.
It feels it should be simple to just edit the cells I want and save the file again but obviously it's more complex that I originally though(or I'm completely blind)
Any help is appreciated.
I'm learning ruby at the moment so that's why I would prefer a solution in ruby.
If you know there are better suited laguages for this feel free to point me in the right direction and I'll check it out.
Thanks in advance
Speaking from experience, there is no Ruby gem that would handle Excel files with all bells, whistles, macros and styling. It is a pity, because Excel is squarely the finest of Microsoft products. In my experience, spreadsheet library can import legacy data from Excel, LibreOffice Calc etc. (I'm not sure about Gnumeric).
As for your problem of getting data from Ruby to Excel, I suggest that you first save Ruby output as a separate file (spreadsheet, CSV, text...) and then teach Excel to import it (eg. using macros).
Another possibility is to abandon Excel for data processing tasks (and possibly keep it for data presentation tasks). Excel is great for presentation and simple data processing, but very bad for complex algorithms.
I wrote gems yzz and y_nelson, which I intended as Ruby replacement for spreadsheets. Yzz provides Ted Nelson's ZZ structures in Ruby (ZZ structure is an improved version of spreadsheet data structure) and y_nelson mixes it with Petri nets (because Petri nets are an improved version of Excel cell functions). Mathematically speaking, a spreadsheed is a hybrid between some sort of multidimensional orthogonal grid of data cells plus a Petri net execution engine. With y_nelson, I hope to bring dearly missed Excel functionality into Ruby, while at the same time moving one step towards better abstraction.
I'm looking for either algorithms or visualization tool for (nice) circuit/block-diagram drawing.
I am also interested in a general formulation of the problem.
By "circuit drawing", I mean the capability of exploring place & route for block-diagrams (rectangles) with I/O ports and their connections (wires). These block-diagrams can be hierarchical i.e some blocks may have some nested internal sub-structure etc.
This topic is strongly related to classical graph-drawing, with the supplemental constraint of the need to take ports location into account, and possibly the shape of the blocks (rectangle of various sizes). Graphviz tools do not respond to the problem (at least my previous experiments have not been satisfactory).
Force-directed algorithms retain my attention, but I have just found papers on classical directed graphs.
Any hints ?
[update nov 21 2013] it seems that the best reference to date is Spönemann
To make production quality circuit diagrams as well as block diagrams, I strongly recommend J. D. Aplevich's "circuit macros". It's well documented and actively maintained. See the examples produced by this package circuit macros examples
There is some learning curve, for example to be able to use the "dpic" graphing language to draw your own diagram. But the tool itself is very powerful.
For me there are two remaining issues:
no live update
svg output is lacking
I hacked up some Javascript to
(watch m4 file change)->[m4->dpic->latex->pdf]->svg->(show in html)
Here is the gist of it
// watch .m4 file
var chokidar = require('chokidar');
var resolve = require('path').resolve;
const touch = require('touch')
const {exec} = require('child_process')
chokidar.watch("*.m4").on('change', fn=>{
let ff = resolve(fn)
console.log(ff, "changed")
exec("runtask.bat " + ff, {cwd:"../"}, (err,stdin,stdout)=>{
console.log(err,stdin, stdout)
touch("index.html") //svg updated
})
})
Here is the runtask.bat for Windows
m4 pgf.m4 %1 | dpic -g > tmp.tex
C:\texlive\2017\bin\win32\pdflatex template.tex
tool\dist-64bits\pdf2svg template.pdf %~dpn1.svg
tool\dist-64bits\pdf2svg template.pdf %~dp1tmp.svg
That way, you can "draw" by writing m4/dpic code and see the result in the browser live; and svg is generated from pdf which looks a lot nicer.
I am also using TikZ at the moment but you may wish to try http://blockdiag.com/
Here is one:
http://www.physicsbox.com/indexsolveelec2en.html
Here is where to look for others:
http://www.freebyte.com/electronics/
www.educypedia.be/electronics/easoftsim.htm
There are alternatives to graphviz that may do the job - see e.g. infovis, protovis, tulip.
See also other related questions 1, 2, 3.
Can you explain where graphviz falls short? The only requirement you list that I'm not sure about is attaching to specific ports. I would have thought you might be able to solve that with composite shapes / subgraphs, but maybe not...?
EDIT: Another option, particularly if you're looking at software engineering diagrams. Have you considered the eclipse gmp toolkit? It's what's used to build e.g. the UML2 editor tools.
hth.
I don't know of any tool that is a clear winner for easily making nice block diagrams with a minimum of manual labor. Some of the best looking results I've seen have been from TikZ. Check out the examples here:
http://www.texample.net/tikz/examples/area/electrical-engineering/
I have been getting very good results from Draw.io. It is a webapp but has a pretty powerful diagram editor and some decent stock symbol libraries. Drawings can be exported as PNG or SVG so can be publication quality and they link up to
The W3 has a RDF validator that plots the RDF graph. Do you know a similar utility desktop side ?
Forgot to say. I'm on a mac.
For example, raptor has the rapper command line utility that can parse various RDF syntaxes and output DOT to be plotted with GraphViz.
(Disclosure: I'm a committer in the raptor project.)
Like laalto said GraphViz is the typical thing to use and many RDF APIs have support built in for generating DOT to be plotted with ut
For example the API I develop (dotNetRDF) has a GraphVizWriter class that you can use to generate DOT files which you can then turn into images in your desired format with the dot.exe command line utility which is part of GraphViz
Though seeing as you're on a Mac my API is probably not much use to you personally - but regardless GraphViz is definitely the way to go.
+1 for using Raptor and Graphviz. Here's how to do it one go (assuming that your RDF is in Turtle syntax):
rapper -i turtle -o dot rdf.ttl | dot -Tpdf -ograph.pdf
The output is written to graph.pdf.