Skip to main content
added 81 characters in body
Source Link

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. Graph is convenient because it colors edges quite easily.

Since I have a 3-regular (or even 4-regular) graph, where there are 3 (or 4) perfect matching, I want each of the matching to be colored differently.

What's the best way to color a group of edges (each perfect matching with it's own color) in the given adjacency list in GraphPlot? To simplify it, we can assume, that groups goes one by one (e.g. we have 6 edges: 3 groups of two edges, following each other

{1<->2, 3<->4, 1<->3, 2<->4, 1<->2, 3<->4}

In Graph, I've constructed a nice lambda function, that wraps all elements of a list in a Style function, that colors the edge. But in a GraphPlot I can't wrap edges in a Style function.

There's an EdgeRenderingFunction, wich draws all the edges. How do I put three different EdgeRenderingFunctions for the one edge-set? Or is that the wrong way to go?

Any ideas, how to do that?

Answer:

The labeled answer is absolutely correct. Little generalization of what I needed and how to implement it:

  GraphPlot[{{1 ->2> 2, 1}, {3 ->4> 4, 1}, {1 ->3> 3, 2}, {2 ->4> 4, 2}, {1 ->2,> 3},{2->4, 3}},              
             {3 -> 4, 3}}, MultiedgeStyle -> .2, 
             ImagePadding -> 10, 
             EdgeRenderingFunction -> (Switch[#3, 1, {Red, Line[#1]}, 
             2, {Blue, Line[#1]}, 3, {Green, Line[#1]}, 
             4, {Dashed, Line[#1]}] &), VertexLabeling -> True, 
             Method -> "CircularEmbedding"]

enter image description hereenter image description here

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. Graph is convenient because it colors edges quite easily.

Since I have a 3-regular (or even 4-regular) graph, where there are 3 (or 4) perfect matching, I want each of the matching to be colored differently.

What's the best way to color a group of edges (each perfect matching with it's own color) in the given adjacency list in GraphPlot? To simplify it, we can assume, that groups goes one by one (e.g. we have 6 edges: 3 groups of two edges, following each other

{1<->2, 3<->4, 1<->3, 2<->4, 1<->2, 3<->4}

In Graph, I've constructed a nice lambda function, that wraps all elements of a list in a Style function, that colors the edge. But in a GraphPlot I can't wrap edges in a Style function.

There's an EdgeRenderingFunction, wich draws all the edges. How do I put three different EdgeRenderingFunctions for the one edge-set? Or is that the wrong way to go?

Any ideas, how to do that?

Answer:

The labeled answer is absolutely correct. Little generalization of what I needed and how to implement it:

  GraphPlot[{{1->2, 1}, {3->4, 1}, {1->3, 2}, {2->4, 2},{1->2, 3},{2->4, 3}}, 
      MultiedgeStyle -> .2, ImagePadding -> 10, 
      EdgeRenderingFunction -> (Switch[#3, 1, {Red, Line[#1]}, 
      2, {Blue, Line[#1]}, 3, {Green, Line[#1]}, 
      4, {Dashed, Line[#1]}] &), VertexLabeling -> True, 
      Method -> "CircularEmbedding"]

enter image description here

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. Graph is convenient because it colors edges quite easily.

Since I have a 3-regular (or even 4-regular) graph, where there are 3 (or 4) perfect matching, I want each of the matching to be colored differently.

What's the best way to color a group of edges (each perfect matching with it's own color) in the given adjacency list in GraphPlot? To simplify it, we can assume, that groups goes one by one (e.g. we have 6 edges: 3 groups of two edges, following each other

{1<->2, 3<->4, 1<->3, 2<->4, 1<->2, 3<->4}

In Graph, I've constructed a nice lambda function, that wraps all elements of a list in a Style function, that colors the edge. But in a GraphPlot I can't wrap edges in a Style function.

There's an EdgeRenderingFunction, wich draws all the edges. How do I put three different EdgeRenderingFunctions for the one edge-set? Or is that the wrong way to go?

Any ideas, how to do that?

Answer:

The labeled answer is absolutely correct. Little generalization of what I needed and how to implement it:

  GraphPlot[{{1 -> 2, 1}, {3 -> 4, 1}, {1 -> 3, 2}, {2 -> 4, 2}, {1 -> 2, 3},              
             {3 -> 4, 3}}, MultiedgeStyle -> .2, 
             ImagePadding -> 10, 
             EdgeRenderingFunction -> (Switch[#3, 1, {Red, Line[#1]}, 
             2, {Blue, Line[#1]}, 3, {Green, Line[#1]}, 
             4, {Dashed, Line[#1]}] &), VertexLabeling -> True, 
             Method -> "CircularEmbedding"]

enter image description here

answer update with a picture
Source Link

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. Graph is convenient because it colors edges quite easily.

Since I have a 3-regular (or even 4-regular) graph, where there are 3 (or 4) perfect matching, I want each of the matching to be colored differently.

What's the best way to color a group of edges (each perfect matching with it's own color) in the given adjacency list in GraphPlot? To simplify it, we can assume, that groups goes one by one (e.g. we have 6 edges: 3 groups of two edges, following each other

{1<->2, 3<->4, 1<->3, 2<->4, 1<->2, 3<->4}

In Graph, I've constructed a nice lambda function, that wraps all elements of a list in a Style function, that colors the edge. But in a GraphPlot I can't wrap edges in a Style function.

There's an EdgeRenderingFunction, wich draws all the edges. How do I put three different EdgeRenderingFunctions for the one edge-set? Or is that the wrong way to go?

Any ideas, how to do that?

Answer:

The labeled answer is absolutely correct. Little generalization of what I needed and how to implement it:

  GraphPlot[{{1->2, 1}, {3->4, 1}, {1->3, 2}, {2->4, 2},{1->2, 3},{2->4, 3}}, 
      MultiedgeStyle -> .2, ImagePadding -> 10, 
      EdgeRenderingFunction -> (Switch[#3, 1, {Red, Line[#1]}, 
      2, {Blue, Line[#1]}, 3, {Green, Line[#1]}, 
      4, {Dashed, Line[#1]}] &), VertexLabeling -> True, 
      Method -> "CircularEmbedding"]

enter image description here

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. Graph is convenient because it colors edges quite easily.

Since I have a 3-regular (or even 4-regular) graph, where there are 3 (or 4) perfect matching, I want each of the matching to be colored differently.

What's the best way to color a group of edges in the given adjacency list in GraphPlot? To simplify it, we can assume, that groups goes one by one (e.g. we have 6 edges: 3 groups of two edges, following each other

{1<->2, 3<->4, 1<->3, 2<->4, 1<->2, 3<->4}

In Graph, I've constructed a nice lambda function, that wraps all elements of a list in a Style function, that colors the edge. But in a GraphPlot I can't wrap edges in a Style function.

There's an EdgeRenderingFunction, wich draws all the edges. How do I put three different EdgeRenderingFunctions for the one edge-set? Or is that the wrong way to go?

Any ideas, how to do that?

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. Graph is convenient because it colors edges quite easily.

Since I have a 3-regular (or even 4-regular) graph, where there are 3 (or 4) perfect matching, I want each of the matching to be colored differently.

What's the best way to color a group of edges (each perfect matching with it's own color) in the given adjacency list in GraphPlot? To simplify it, we can assume, that groups goes one by one (e.g. we have 6 edges: 3 groups of two edges, following each other

{1<->2, 3<->4, 1<->3, 2<->4, 1<->2, 3<->4}

In Graph, I've constructed a nice lambda function, that wraps all elements of a list in a Style function, that colors the edge. But in a GraphPlot I can't wrap edges in a Style function.

There's an EdgeRenderingFunction, wich draws all the edges. How do I put three different EdgeRenderingFunctions for the one edge-set? Or is that the wrong way to go?

Any ideas, how to do that?

Answer:

The labeled answer is absolutely correct. Little generalization of what I needed and how to implement it:

  GraphPlot[{{1->2, 1}, {3->4, 1}, {1->3, 2}, {2->4, 2},{1->2, 3},{2->4, 3}}, 
      MultiedgeStyle -> .2, ImagePadding -> 10, 
      EdgeRenderingFunction -> (Switch[#3, 1, {Red, Line[#1]}, 
      2, {Blue, Line[#1]}, 3, {Green, Line[#1]}, 
      4, {Dashed, Line[#1]}] &), VertexLabeling -> True, 
      Method -> "CircularEmbedding"]

enter image description here

deleted 217 characters in body; edited title
Source Link
rm -rf
  • 89.3k
  • 21
  • 297
  • 479

Coloring edges in GraphPlot edge coloring

hope you're doing good!

As for me - I'm a little stuck with graph drawing part of my research: as it turned out, I needed some graph data to be visualized, so I've decided to use Mathematica for it.

But it turned out, that I can't use nicethe Graph function for itplotting my graphs, causebecause my graph is a multi-graph. The reason, I've decided to use Graph function, is convenient because it colors edges quite easyeasily. 

Since I have a 3-regular (or even 4-regular) graph, where there'rethere are 3  (4or 4) perfect matching, and I want each of the matching to be colored differently.

What's the best way to color a group of edges in the given adjacency list in GraphPlot function? To simplify it, we can assume, that groups goes one by one (e.g. we have 6 edges: 3 groups of two edges, following each other

{1<->2, 3<->4, 1<->3, 2<->4, 1<->2, 3<->4}).

{1<->2, 3<->4, 1<->3, 2<->4, 1<->2, 3<->4}

ForIn Graph function, I've constructed a nice lambda function, that wrapperswraps all elements of a list in a Style function, that colors the edge. But in a GraphPlot I can't wrap edges in a Style function.

There's an EdgeRenderingFunction, wich draws all the edges. But how toHow do I put three different edgeRenderingFunctionsEdgeRenderingFunctions for the one edge-set? Or is that the wrong way to go?

Any ideas, how to do that?

GraphPlot edge coloring

hope you're doing good!

As for me - I'm a little stuck with graph drawing part of my research: as it turned out, I needed some graph data to be visualized, so I've decided to use Mathematica for it.

But it turned out, that I can't use nice Graph function for it, cause my graph is a multi-graph. The reason, I've decided to use Graph function, is because it colors edges quite easy. Since I have a 3-regular (or even 4-regular) graph, where there're 3  (4) perfect matching, and I want each of the matching to be colored differently.

What's the best way to color a group of edges in the given adjacency list in GraphPlot function? To simplify it, we can assume, that groups goes one by one (e.g. we have 6 edges: 3 groups of two edges, following each other

{1<->2, 3<->4, 1<->3, 2<->4, 1<->2, 3<->4}).

For Graph function I've constructed a nice lambda function, that wrappers all elements of a list in a Style function, that colors the edge. But in a GraphPlot I can't wrap edges in a Style function.

There's an EdgeRenderingFunction, wich draws all the edges. But how to put three different edgeRenderingFunctions for the one edge-set? Or is that the wrong way to go?

Any ideas, how to do that?

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. Graph is convenient because it colors edges quite easily. 

Since I have a 3-regular (or even 4-regular) graph, where there are 3 (or 4) perfect matching, I want each of the matching to be colored differently.

What's the best way to color a group of edges in the given adjacency list in GraphPlot? To simplify it, we can assume, that groups goes one by one (e.g. we have 6 edges: 3 groups of two edges, following each other

{1<->2, 3<->4, 1<->3, 2<->4, 1<->2, 3<->4}

In Graph, I've constructed a nice lambda function, that wraps all elements of a list in a Style function, that colors the edge. But in a GraphPlot I can't wrap edges in a Style function.

There's an EdgeRenderingFunction, wich draws all the edges. How do I put three different EdgeRenderingFunctions for the one edge-set? Or is that the wrong way to go?

Any ideas, how to do that?

added 173 characters in body
Source Link
Loading
Source Link
Loading