Message Boards Message Boards

GROUPS:

[✓] Place the vertex labels in a bipartite graph?

Posted 1 year ago
1320 Views
|
2 Replies
|
2 Total Likes
|

Hello, I was wondering if someone could help me place the labels for the nodes of my bipartite graph such that they do not intersect with the graph itself. If I use Placed, then it of course shift all of the labels (as you can see in my example file). I'd like the left hand labels to basically stay where they are and the right hand ones to shift to the right of the vertices.

Additionally, and on an unrelated note, I'd like to highlight the outgoing edges from the United States node if possible.

Using BipartiteEmbedding to display this data may also not be the most efficient way to do so so I'm definitely open to suggestions as well. Thank you ahead of time.

-Abhik

Attachments:
2 Replies

Abhik,

I am certain there is a more general way to do this but I relied on the fact that you used Strings for the Left-hand Nodes and Entities for the right hand nodes. Some of the other "Graph Experts" here, like @Szabolcs Horvát will likely have a more universal way to do this sort of thing. -- In fact you may want to use his iGraph package but I am not that familiar with it since I rarely do graphs.

Graph[graphData2, 
 VertexLabels -> {x_String -> Placed["Name", Before], 
   x_Entity -> Placed["Name", After]}, 
 GraphLayout -> "BipartiteEmbedding", ImageSize -> Large]

to get

enter image description here

Regards,

Neil

As for your edges:

Graph[graphData2, 
 VertexLabels -> {x_String -> Placed["Name", Before], 
   x_Entity -> Placed["Name", After]}, 
 EdgeStyle -> {DirectedEdge["United States", _] -> {Thick, Red}}, 
 GraphLayout -> "BipartiteEmbedding", ImageSize -> Large]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract