Questions about handling graphs in Mathematica, graph theory, graph visualization, GraphPlot, the built-in Graph type and the Combinatorica` package.

learn more… | top users | synonyms (2)

7
votes
2answers
449 views

HighlightGraph with different styles

I want to highlight two different directed paths on a graph with two different style. I am using the following two code snippets: ...
6
votes
3answers
581 views

Graph adjacency matrix with unconnected nodes

I am trying to display a series of 9x9 adjacency matrices which represent directed graphs on a 3x3 grid. The issue I am running up against is this (compounded by that fact that I don't really know how ...
6
votes
2answers
610 views

Coloring edges in GraphPlot

I'm a little stuck with graph drawing part of my research — I can't use the Graph function for plotting my graphs, because my graph is a multi-graph. ...
5
votes
2answers
197 views

Is there something wrong with VertexConnectivity

As I noticed in the documentation VertexConnectivity is defined as the following The vertex connectivity of a graph $g$ is the smallest number of vertices whose ...
21
votes
3answers
2k views

How to generate a random tree?

Is it possible to generate a random tree without explicitly constructing a random adjacency matrix that satisfies tree properties? How about a random directed tree? Edit: incredible answer by ...
15
votes
2answers
614 views

How to measure segment length and branch angle

I am trying to measure segment length and branch angle or bifurcation angle between each pair of segments. My image after thinning looks like this: ...
18
votes
1answer
400 views

How to visualize large graphs with directed edge bundling

I'm wondering if anyone has implemented edge bundled graph plotting? http://www.win.tue.nl/~dholten/papers/forcebundles_eurovis.pdf
14
votes
3answers
1k views

Creating diagrams for category theory

Lately I've been doing algebra and I have found myself drawing a bunch of diagrams when I attempt to solve a problem. Most of the diagrams are very simple so I thought, I bet I can do this in ...
14
votes
2answers
540 views

How can I speed up the classic GA for graph coloring?

I'm trying to compute the chromatic number of this graph (which is 28): g = Import@"http://www.info.univ-angers.fr/pub/porumbel/graphs/dsjc250.5.col"; My genetic ...
12
votes
2answers
1k views

How to convert an image to a graph and get the positions of the edges?

I am trying to convert an image to a graph. My image is already skeletonized and looks pretty much like this: What I need to do is identify all vertices and edges, and in particular get a list of ...
11
votes
1answer
320 views

Dynamic visualization of Graph[] on a webpage

How can we embed a dynamic version of a Graph object on a web page, similar to the one showcased on the networkx home page? This sort of dynamic visualization can ...
10
votes
1answer
530 views

Roads network visualization by thickness and color intensity by population from GIS files

We can have road networks of the countries in GIS shape file.For exmple from here. Normally traffic flows are proportionate to populations of the cities. I wonder how we can have the same in ...
16
votes
3answers
443 views

How to get complete Documentation Center graph of guide pages?

On the very last image below you can see a typical path of walking through Documentation Center guide pages. What is the best way to get the graph data and visualize the whole structure of these ...
13
votes
3answers
613 views

How to find all vertices reachable from a start vertex following directed edges?

How to find all vertices reachable from a given start vertex following directed edges, in a cyclic directed graph given as ...
12
votes
2answers
487 views

Calculating morphometric properties

Is it possible to calculate segment length, segment diameter and branch angles for three dimensional geometry. Geometry contains vertex points and polygon surfaces as ...
20
votes
1answer
834 views

Graph vs GraphPlot

What is the difference (in purpose) between Graph and GraphPlot? Which function is bested suited to which tasks? Background: I ...
15
votes
3answers
229 views

What is the most convenient way to change options for Graph[] objects?

What is the most convenient way to change options such as VertexLabels in existing Graph objects? (Version 7 users note: ...
7
votes
1answer
331 views

How to visualize the structure of this dynamic programming code

I am studying Mr. Wizard's answer to this question which tries to identify elementary circles in a graph. That answer uses dynamic programming technique to simplify the code. The underlying guideline ...
7
votes
4answers
310 views

Can I stop edges in graphs from drawing on top of the vertices?

Consider the following testadj = RandomVariate[BernoulliDistribution[0.15], {50, 50}]; AdjacencyGraph[testadj, VertexSize -> Large] The nodes are almost ...
17
votes
2answers
359 views

Packed Graph or GraphPlot output with non-square layout?

Graph or GraphPlot produce square layouts for disconnected graphs: Graph[Table[i -> Mod[i^3, 100], {i, 1, 100}]] I´d like to get a rectangular layout with ...
13
votes
4answers
436 views

How to recompute the layout of a Graph?

I asked a question about changing Graph properties in a similar way to how Show can change ...
5
votes
3answers
234 views
5
votes
2answers
267 views

Is there something akin to “SubgraphIsomorphismQ” in Mathematica 9?

Provided two unlabeled graphs, $G$ and $H$, I would like to test where $H$ is a subgraph of $G$. In other words, I'd like to test whether we can prune some fixed number of vertices or edges from $G$ ...
14
votes
1answer
386 views

When to use built-in Graph/GraphPlot vs. Combinatorica

What are the pros and cons of using built-in Graph/GraphPlot (and related) types vs. types in the Combinatorica package?
12
votes
1answer
191 views

Layout a second graph of the same nodes in the same way

I have a number of graphs with the same nodes. I would like to be able to somehow save the layout that results from the spring embedded results of one graph (the first image), and have the other ...
9
votes
3answers
373 views

FindShortestTour for charity (or: How can I optimize meal delivery with FindShortestTour?)

I've been wondering about this for a while - but never got around to asking - until I saw faleichik's incredible answer to Mathematica Minecraft. I did some work at a not-for-profit a little while ...
9
votes
2answers
251 views

Determining whether two $k$-chromatic graphs are isomorphic (respecting vertex coloration)

Consider the case where I have two $k$-chromatic graphs $G_1$ and $G_2$, i.e. two graphs where individual vertices can be colored with one of a set of $k$ total colors, and I would like to determine ...
9
votes
2answers
305 views

Transition between graphs

I want to visually demonstrate the manipulations made to a graph. For instance, I have a graph g where using the command ...
8
votes
2answers
448 views

Extracting vertex coordinates from an automatically laid out graph

Given a Graph with an automatically computed layout (i.e. not explicitly given VertexCoordinates, but using a ...
6
votes
3answers
279 views

Flow in pipeline graph

I have pipeline directed graph which has one source and several sinks ...
5
votes
1answer
383 views

How to display each step of an A star algorithm?

I wrote a pathfinding program: A*, which is an extension of Dijkstra. I want to see the result of each step at a time. Which function should I use? The main program is the notebook Astar, which is ...
5
votes
2answers
328 views

How to add new nodes to an existing graph with fixed (coordinates) nodes?

I'm ultimately trying to create a directed graph with some of the nodes in fixed positions and the other nodes placed around them in "acceptable" positions. It's better if I ask the question by ...
5
votes
2answers
1k views

How to find the Shortest Path, visiting ALL vertices, without coming back to the start (Hamiltonian Path, minimum distance)

A car has to pick up each person and take them to their destination. I am trying to find the shortest tour that will do this. How can I find the shortest path between any s and t.... visiting all ...
5
votes
3answers
1k views

Travelling salesman with start and end points for 30 points

I am doing a route optimisation for delivery vehicles and failing dismally. Please see problem statement below. My current solution uses FindShortestTour, but this does not have defined start and end ...
5
votes
1answer
214 views

How to view all graphs available in GraphData?

Is there a "gallery" view of all the graphs available in GraphData? I realize that some graphs may not lend themselves to such representation (e.g. some may have ...
5
votes
1answer
966 views

When do I use Mathematica, when do I use Gephi, and how do I use them together?

Mathematica has great operations for analyzing graphs but when the graphs are a bit bigger, Gephi seems to be more efficient (at least on my computer) at drawing and analyzing, i.e. visualizing the ...
3
votes
3answers
290 views

Generating a graph where vertices correspond to points in an integer lattice and edges connect points less than a threshold distance apart

I'd like to automatically generate a graph where vertices correspond to (and have the coordinates of) points in an $A \times B$ integer lattice, and a graph is generated by connected vertices within a ...
3
votes
2answers
218 views

Showing a forest with root of the trees on the top

I have a Graph object that contains a forest with directed trees. I want to draw the forest such that the root of the trees are on the top and the leaves are on the bottom. If I use the following line ...
1
vote
2answers
334 views

EdgeRenderingFunction question

(Edit 1 : I added this paragraph after the original post, for context) Some context for this question can be found in another post (Problem with EdgeRenderingFunction), which however may be taken ...
9
votes
1answer
146 views

Algorithm used by IsomorphicGraphQ

I'd like to know which algorithm is used to test if two graphs are isomorphic?
7
votes
2answers
295 views

Convert Graph to Graphics

In Mathematica 9, a graph is returned as an object with head Graph: In[8]:= CompleteGraph[8] // Head Out[8]= Graph ...
7
votes
1answer
817 views

Dynamic Graph visualization

I'm working on a C++ library that will be used to construct and study certain graphs (as in a set of connected vertices, not a function plot). These graphs will be dynamic in nature (and can ...
6
votes
2answers
263 views

How to color edges of a graph which has multiple edges connecting certain vertices

I'm studying BIBD(Balanced Incomplete Block Design) and want to draw some graphs by coloring their blocks in different colors, respectively. A block is a collection of edges (or vertices). For ...
6
votes
1answer
138 views

Property assignment on a graph vertex using PropertyValue does not work inside a function

I created this function: AddStone[board_Graph, v_, s : white | black | empty] := PropertyValue[{board, v}, VertexState] = s This function should change the ...
6
votes
2answers
230 views

Truncate TreeForm to show only the top

For some expressions, TreeForm may grow very long. I'm only interested in the top levels of the expression. How can I get the tree form of only the first levels an ...
5
votes
1answer
494 views

How can I draw a polygon from a set of angles?

In recreational mathematics, polytans are polygons formed by edge-connecting isosceles right triangles. Order-n polytans are those constructed from n such triangles. My question is this: Given a ...
4
votes
1answer
422 views

Analysis of Facebook group

I am the admin of a Facebook group for our year at university and wanted to graph the members of the group like you can with your own friends so we can find the isolated people and get rid of them (as ...
4
votes
2answers
246 views

Efficiently determining the largest minimum cost to travel from a fixed source to an arbitrary sink in a weighted graph

Let $v_i$ be a vertex in a graph $G$ with vertices $(v_1,...,v_N) \in V$ and edges $(e_1,...,e_M) \in E$ with associated weights $(w_1,...,w_M)$. Let $v_s \in V$ be specified vertex in the graph. In ...
4
votes
1answer
1k views

Is it possible to generate a Hasse Diagram for a defined relation?

I'm looking for a way to create a Hasse Diagram from a given partial order binary relation. The relation will be given explicitly, for example: ...
0
votes
1answer
161 views

Display a labeled multigraph

Despite the integration of graphs and networks, multigraphs are not supported in Mathematica 8+. In Mathematica 9+, GraphPlot misbehaves for multigraphs having ...