Draw real graph (graphviz?) - graph

I´m working with different graph algorithms, and for testing, and see the results, i need to visualize the graph.
I´m trying to use graphviz for visualization, but i dont want to use any Layout Engine, just use the real coordinates of the points.
For example: some TSPLIB instances have coordinates like: 1.54400e+04 8.88800e+03
Is this posible? should i use another tool?
Thanks in advance !

Define the nodes like
nodename [pos="2,4!"];
to position them at (x=2|y=4) (the unit is inches).

Try GoogleCharts
http://code.google.com/apis/chart/

Related

Make lines in .vtp file

I want to visualize a graph in 3d in paraview. This requires me to have points and edges connecting the points. I know how to make the points but can't seem to figure out how to make the edges.
Currently I can make .vtp files with points and associated vectors. I want to know how to modify my .vtp files to include these edges as well.
Thanks for any help!
You should use a vtkLineSource:
vtkSmartPointer<vtkLineSource> lineSource =
vtkSmartPointer<vtkLineSource>::New();
lineSource->SetPoint1(p0);
lineSource->SetPoint2(p1);
lineSource->Update();
lineSource->GetOutput() will give you a polydata that you can then write with a vtkXMLPolyDataWriter. See a full example here: http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Line

Label individual points in Sage plot

This seems like a straightforward problem, yet I can't find a solution. In Sage, I've got about 30 sorted points for a scatter_plot, and I want to add the order position as a label. I know this is easy if I were working with a graph object, since I could use the vertex_labels option in plot. Is there a simple fix to get this to work for a scatter_plot, or would I need to do something like make the points vertices and keep track of the exact location of each point
Currently, you may have to use matplotlib directly or mess around with that method inside of Sage to get this. See here or here for some related questions.
I've opened Trac 20583 for this.

Graph with auto layout using d3 (a tree with multiple parent nodes)

How to draw a graph with auto layout, many-to-many with lines not crossing the boxes using d3?
I'd like to accomplish something like this:
http://www.graphdracula.net/showcase/
http://live.yworks.com/yfiles-for-html/1.1/demos/DataBinding/demo.yfiles.binding.interactivegraphsource/index.html
I guess that's the best description of what I need (something like tree, but with multiple parents):
Dagre-d3 is the best solution that I found:
https://github.com/cpettitt/dagre-d3
For anyone else who comes across this, here's another possible solution: (see the "Directed Graph with downward-pointing edges" example)
http://marvl.infotech.monash.edu/webcola/
It can also be plugged into d3.js and used in place of the force layout.
To minimize line crossings, you probably need a layered digraph layout. Just google that phrase.

How to draw a directed graph with labels on edges using quickgraph and graph# libraries?

I'm trying to draw a directed graph with labels on edges. I'm using graph# (graphsharp) and quickgraph, and I saw an explanation in the forums about how to add labels (it is not supported by the library), but cannot manage to implement myself. If someone could provide a working example using these two libraries I would be very thankful.
Update:
I'm now looking for something a little more complicated: My edges behave like nodes, they have connections to other nodes and have a name-tag. So they are like any other node, and when I draw the graph these edge-nodes must appear exactly in the middle of a certain connections. Any ideas?
Although it's not documented, QuickGraph supports output to other formats, like DGML. VS 2010 includes a very basic DGML viewer. It may be possible to output DGML so that the resulting graph has edge labels. However you will likely need to add support yourself.
Download the QuickGraph sources and play around with it. I'm a committer on the project, so if you figure it out let me know and we'll get your changes into the project.

Combining 3D/2D plots

I'm trying to make a visualization that looks like this http://www.gradient-da.com/img/temperature%20surface%20plot%20470x406.JPG http://www.gradient-da.com/img/temperature%20surface%20plot%20470x406.JPG.
The idea is to have a 3D surface plot overlapping a 2d representation of a surface.
I can build arbitrary surfaces/polygon shapes (as in http://addictedtor.free.fr/graphiques/graphcode.php?graph=135 ) and I can make the respective 2D plot. What I don't seem to be able to figure out is the way to put them together in a nice way (like the one shown in the jpg above).
I've tried googling for the answer, but I wasn't able to find anything similar done in R.
Any help would be greatly appreciated!
EDIT: The 2D portion is not a projection of the 2D one. I chose this specific picture to illustrate this. For example
Here the 2D portion is the image of the circuit and on the 3D portion is the temperature).
In 2D you can have the map of a city and in 3D the traffic
etc...
Best,
Bruno
I will give a theoretical Idea,
In the same 3D plot, select a plane perpendicular to the 3D surface (just below the 3D-surface) and project all the values to it. Instead of 2D & 3D plot, you will use only a 3D plot, which also plots your surface.
HTH
It looks like the 2D plot is a layout of a microelectronic circuit, albeit with some detail skipped, and the 3D plot is perhaps a thermal plot of the same circuit.
I don't know enough about R's capabilities, but I imagine it would be easier to generate the two plots separately with R from the same dataset which represents the layout information (but with and without the thermal data) and then combine them with a graphics manipulation program.
No help in R, but you can do something similar in ROOT as seen in this image:
taken from the THistPainter class documentation.
The code is open source and could be examined if wanted for reimplementation.
Maybe you should try to make an opengl texture out of your 2d picture and map it on a 3d polygon to be included in your scenegraph?
Don't really understand if you wish to do it with R specifically, so maybe diving in opengl is a too low level for you. In case you'd be ready for that, you may reuse a simple java library that simplify plotting 3d surface: http://code.google.com/p/jzy3d
Hope that helps,
Martin
What you're looking for is called a texture map -- and if it's not provided in the R graphics package, you may be able to do it "by hand". The suggestion below may not be fast or convenient (or even helpful, as I'm not really familiar with R), but it may actually work...
Since you know you can draw a 3D surface plot with specified colors, you can try drawing a flat 3D surface using the colors of your image.
If R also lacks methods for extracting its data from image formats, there is an image format called PPM (standing for Portable PixMap), one variant of which is basically space-separated decimal numbers. After converting your image to this format (using Photoshop, say, or some dedicated image conversion program), it should be relatively easy to input into R.

Resources