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)

4
votes
2answers
167 views

HighlightGraph with style

In this picture you see a graph. The shortest path between vertex 5 and vertex 3 is highlighted in red. Instead I want blue highlighted edges of thickness 10. ...
4
votes
2answers
1k views

How do I plot a solution of a differential equation?

I am having trouble generating a plot for a solution to my differential equations. I always end up with just blank axes. ...
4
votes
3answers
484 views

Graph generation given number of edges and nodes

I was wondering if it is possible to have Mathematica generate all graphs with a given number of edges and nodes (and possibly restricting the adjacencies) and draw them I know that there are some ...
4
votes
2answers
209 views

Odd behavior of GridGraph and DirectedEdges

For some reason the option DirectedEdges->True, albeit working internally with grid graph, does not appear in the visualisation for 1D and 2D graphs. It also ...
4
votes
1answer
105 views

How to impose control over vertex-to-vertex Graph edges?

I’m working on a Markov Chain and hope there is a way to impose control over how Mathematica places edges to connect vertices in a Graph. My Markov Chain currently consists of 4 vertices with 2 of the ...
4
votes
2answers
116 views

BezierCurve in EdgeShapeFunction fails when used on multiedges graph

I would like to create a network graph with curved edges. To do this, I wrote this function: ...
4
votes
2answers
826 views

Finding face vertices from the face adjacency graph

I have a question about face adjacency graphs. Suppose that I have an adjacency matrix ...
4
votes
1answer
363 views

Get the neighboring vertices and incident edges from a vertex in a graph

I need to get the neighboring vertices and incident edges from a vertex in a graph. I assume NeighborhoodVertices can be used for the former. Anything better? Or ...
4
votes
3answers
521 views

Place graph vertex labels in circles

Consider the following code: ...
4
votes
1answer
104 views

The algorithm of ListGraphs[n,m]

I'm not sure if this is a Mathematica problem, math problem or a CS problem, so if this is off-topic please transfer it. In the package Combinatorica there is a ...
4
votes
2answers
116 views

TreePlot, VertexRenderingFunction and stretched vertices issue

Recently I found the following TreePlot issue. For simplicity, I took an example from Mathematica Tree Drawing Tutorial and set ...
4
votes
1answer
115 views

Agglomerate output to Graph

I'm using the HierarchicalClustering package to cluster some data. So let's say I have this: ...
4
votes
1answer
151 views

How do I make the color of arrowheads in a graph different from the colors of the arrows?

I'm graphing a Markov process mp = DiscreteMarkovProcess[{1, 0, 0}, ({ {0.6, 0.1, 0.3}, {0.2, 0.7, 0.1}, {0.3, 0.3, 0.4} })]; and would like ...
4
votes
1answer
129 views

Katz Centrality [closed]

I want to calculate the Katz Centrality of large graphs. The Mathematica command to do that is KatzCentrality[g, $\alpha$] and it is also fast. However I realized that there is a mismatch between ...
4
votes
1answer
412 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
1answer
145 views

Dijkstra without Combinatorica

There is some overlap between Combinatorica and the Graph related framework but there are also various elements missing. As far as I can see there is no 'Dijkstra' method or algorithm in Mathematica ...
4
votes
2answers
157 views

Total weight of a graph

I need to find the total weight of an WeightedAdjacencyGraph. I have a graph in that form ...
4
votes
2answers
127 views

LayeredGraphPlot: two instances of the same label

What I'd like to do is to have the same label more than once in the plot. I.e. I do not want the edges to direct toward the first instance of that label! For example: ...
4
votes
1answer
697 views

Creating a weighted, directed graph from ordered triples

I have a relatively large set of data that I am trying to turn into a weighted, directed graph. The data concerns the inflow of migrants based on country of origin. I currently have three columns of ...
4
votes
1answer
212 views

Counting the size of the minimum cut produced by MinCut of GraphUtilities`

I want to use the MinCut function of the GraphUtilities` package to find minimum cuts for a few graphs. I'm completely new to ...
4
votes
1answer
165 views

HITS centrality

I want the centrality measure of a particular vertex in my graph, and for Closeness, Betweenness and Degree centralities I have been using : ...
4
votes
1answer
165 views

Compatibility issues for Combinatorica package

I am trying to use the Combinatorica package in a Mathematica version 9 in the following code : ...
4
votes
1answer
86 views

How to construct a polyhedron from its vertex graph?

Consider the graph given by ...
4
votes
1answer
53 views
4
votes
1answer
128 views

Functional Programming: modify EdgeList based on condition

I have a simple functional programming question: I have a simple EdgeList defined in Mathematica, I would like to modify the value of certain element of the list based on a condition. I see how to ...
4
votes
1answer
461 views

(Efficiently) Generating graphs with vertex degree 3 for all vertices

I'm working on a graph theory problem, and given $n$ vertices, I would like to be able to generate all non-isomorphic connected graphs (not necessarily simple) with $n$ vertices, each having degree 3. ...
4
votes
1answer
169 views

Enhancing GraphUtilities' GraphEdit

One thing I use Mathematica for is building molecular graphs. Until now, I've been content with generating an adjacency matrix from SMILES data, and passing that to ...
4
votes
1answer
226 views
4
votes
2answers
101 views

How to obtain all the distinct De Bruijn sequences?

In combinatorial mathematics, a $k$-ary De Bruijn sequence $B(k, n)$ of order $n$ is a cyclic sequence of a given alphabet $A$ with size $k$ for which every possible subsequence of length $n$ in $A$ ...
4
votes
1answer
197 views

What's the most intelligent way to store the information of a selfmade graph?

I have a very long list of element, say $a1,a2, a3$,..., and they are all connected in that each is the child of many parents. E.g. $a74$ is associated with $a2,a55,a71$, and also contains ...
4
votes
1answer
240 views

Removing edge weights from a Graph

How can I remove EdgeWeights from a Graph without affecting any other properties of the graph? Let's construct a graph with ...
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: ...
4
votes
0answers
102 views

How to draw hypercube graphs

I'd like to draw hypercube projections like those on the Wikipedia page: I tried with HypercubeGraph[6] but the graph does not look right; it is not ...
4
votes
0answers
113 views

Efficient Generation of Subgraphs (or, unfriend a friend a day)

NB: If you're not interested in the back-story, you could simply jump forward to the code which I'm seeking to optimize. Also, I believe this code would only work for MMA 8.0 and above. My friends ...
4
votes
0answers
231 views

Counting paths of a certain length between a source and sink vertex

I have a graph $G$, which may be directed or not, and I was wondering if there was an efficient way of using, say, BreadthFirstScan[] and FindShortestPath[] to count the number of paths between some ...
4
votes
0answers
383 views

Finding a Graph Shortest Path with Custom Graph Distance Function

What is the best way to find a shortest path by using a custom distance function? I'm trying to play a little bit with the concept of using distributions instead of a deterministic weight value for ...
3
votes
2answers
201 views

Horizontal Tree Layout? [duplicate]

I need to display arbitrary Expressions in TreeForm, but the standard vertical layout produces too many horizontally overlapping boxes. Am I doomed to rewriting ...
3
votes
3answers
178 views

Product of edge weights in path

I need to calculate the product of graph edge weights on the path taking into account edge direction. I.e. for graph ...
3
votes
4answers
466 views

Graph Creation in Mathematica: TSP

I'm trying to create the following graph in Mathematica Where do I start? I'm specifically trying to make a graph so that I can use it in TravelingSalesman[g], ...
3
votes
3answers
785 views

How to draw a directed graph with arrows showing vertically from bottom to top

If I have a directed graph, how can I draw it with arrows pointing vertically from bottom to top, like showing a class inheritance pattern in OOP(object oriented programming)?
3
votes
2answers
113 views

Harmonious graph labeling

Is it possible to harmoniously label a graph in Mathematica? I would like a function, that when given a graph, would return a harmonious labeling. If not, is there other software that can do it? A ...
3
votes
1answer
1k views

How can I draw the transition diagram of a Markov chain?

I apologize for my heaviness as I am a Mathematica novice. Is there a kind soul who can tell me how to draw diagrams like those shown on page 158, 160 and 161 of this document.Chaine de Markov I ...
3
votes
2answers
165 views

The same value of VertexSize for vertices in different graphs causes different vertices size

I generated some graphs. The smallest vertices in the 1st graph should be the same size as the smallest vertices in the second graph. The smallest vertices have the same size (...
3
votes
2answers
281 views

Combinatorica: Girth[] and FindCycle[] disagreement

Warning: run the following code in a fresh Mma session, as some symbols could be shadowed (depending on your Mma version) While trying to answer this question, I fell into the following: ...
3
votes
2answers
106 views

Turning evaluation off

I am making a directed graph, but Mathematica keeps trying to evaluate my labels. I know that I can just use " ", but I have a lot of input. Is there a way to turn evaluation off? ...
3
votes
1answer
147 views

Social Network Analysis - Get the End Points of an Edge

I want to get the end points of an Edge of a Graph. For example see the following source, ...
3
votes
1answer
761 views

How to write a function to add edges or vertex to a graph

I need to add either a vertex or an edge to a graph, and also sometimes, vertices or edges, or a mixture of the two. How to write a function for this?
3
votes
2answers
61 views

How to get all leaves from a graph's specific node

Let's say I have this graph (The code to generate the graph is at the end) How can I extract all the leaves comming from, let's say "cluster3"?, i.e. {100, 92, 87, 89} I guess I have to first ...
3
votes
3answers
121 views

EdgeRenderingFunction on a Graph plot

This is my code, I want each line leaving a vertex to be the same colour from that vertex. So there should be 5 different coloured lines one colour for each vertex. ...
3
votes
2answers
110 views

CommunityGraphPlot doesn't size

When I need to plot a 'large' graph with CommunityGraphPlot the output is always sized at the Mathematica default value. The Graph object itself can be resized with ImageSize option. However that ...