1
$\begingroup$

I would like to add the names of vertL to this HighlightGraph. edges.csv is a two-column list of names, for example: Bob Susan Susan Jane Jane Susan Susan Bob

edges = Import["edges.csv"];
edgeList = Table[
  edgelist[[row, 1]] -> edges[[row, 2]],
  {row, 1, Length[edges]}]
vertL = VertexList[edgeList]
dc = DegreeCentrality[edgelist]
dc = N[Rescale[dc]]
assign = Thread[vertList -> dc]
HighlightGraph[edgeList, vertL, VertexSize -> assign]
$\endgroup$
0

1 Answer 1

1
$\begingroup$

HighlightGraph >> Details and Options:

HighlightGraph takes the same options as Graph.

So you can use the option VertexLabels.

SeedRandom[123]
edges = DeleteDuplicates@RandomChoice[Subsets[CharacterRange["A", "F"], {2}], 10];
edgeList = Rule @@@ edges;
vertL = VertexList[edgeList];
dc = N@Rescale@DegreeCentrality[edgeList];
assign = Thread[vertL -> dc];

HighlightGraph[edgeList, vertL, VertexSize -> assign, 
 VertexLabels -> Placed["Name", Center], VertexLabelStyle -> 20]

enter image description here

Alternatively, you can use SetProperty to add options to the graph object produced by HighlightGraph

g2 = HighlightGraph[edgeList, vertL, VertexSize -> assign];
SetProperty[g2, {VertexLabels -> Placed["Name", Center], VertexLabelStyle -> 20}]

same picture

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.