How to plot connected components in the format of community structure plot?Visualizing subgraphs while specifying the locations of vertexesHow to divide a graph into connected components?How can I highlight and individually color the connected components of a graph?Connected components of a graphExtracting a single weakly connected component from a network of many weakly connected components?How to find number of connected components of graph G?Understanding performance: graph connected componentsVisualizing subgraphs while specifying the locations of vertexesNetwork Graph: show highly connected componentsVertex coloring for bi-connected componentsTrim graph to fully connected components?

Trying to build a function to compute divided difference for arbitrary list of points

A planet illuminated by a black hole?

Convert every file from JPEG to GIF in terminal

Is dd if=/dev/urandom of=/dev/mem safe?

Invert Some Switches on a Switchboard

Why isn't there a ";" after "do" in sh loops?

Why isn't there a serious attempt at creating a third mass-appeal party in the US?

Are there any examples of technologies have been lost over time?

How to deal with a player who makes bad characters and kills them?

Is there a reason why I should not use the HaveIBeenPwned API to warn users about exposed passwords?

Iterate over non-const variables in C++

Explain why watch 'jobs' does not work but watch 'ps' work?

How do campaign rallies gain candidates votes?

401(k) investment after being fired. Do I own it?

Spoken encryption

How do I stop my characters falling in love?

Why can't my huge trees be chopped down?

Giant space birds hatching out of planets; short story

Timing/Stack question about abilities triggered during combat

Basic Questions on Wiener Filtering

Why does RPM for a fixed-pitch propeller change with an aircraft's pitch?

Print sums of all subsets

Is this photo showing a woman posing in the nude before teenagers real?

Did the IBM PC use the 8088's NMI line?



How to plot connected components in the format of community structure plot?


Visualizing subgraphs while specifying the locations of vertexesHow to divide a graph into connected components?How can I highlight and individually color the connected components of a graph?Connected components of a graphExtracting a single weakly connected component from a network of many weakly connected components?How to find number of connected components of graph G?Understanding performance: graph connected componentsVisualizing subgraphs while specifying the locations of vertexesNetwork Graph: show highly connected componentsVertex coloring for bi-connected componentsTrim graph to fully connected components?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3












$begingroup$


I have the following code plotting community structure of random graph g. As one can see, the community structure plot presents a nice visual impact. I like to generate a similar plot for the connected components of g using ConnectedComponents[g]. HighLightGraph is showing individual vertices in a given component with the same color but this kind of presentation is not so useful for my purpose. I like to see the components linked to each other through binary links between the components.



SeedRandom[4];
g = RandomGraph[30, 50, DirectedEdges -> True];
gg = ConnectedComponents[g];
CommunityGraphPlot[g, CommunityRegionStyle -> LightGray,
Method -> "Centrality"];
HighlightGraph[g, Subgraph[g, #] & /@ gg];


Thanks.










share|improve this question











$endgroup$







  • 1




    $begingroup$
    does CommunityGraphPlot[g, gg, CommunityRegionStyle -> LightGray, Method -> "Centrality"] give what you need?
    $endgroup$
    – kglr
    Jul 17 at 4:19






  • 1




    $begingroup$
    @kglr: Yes, it gives what I want to see. In fact, your solution provides answers to several of my problems. Thank you very much...
    $endgroup$
    – Tugrul Temel
    Jul 17 at 4:27

















3












$begingroup$


I have the following code plotting community structure of random graph g. As one can see, the community structure plot presents a nice visual impact. I like to generate a similar plot for the connected components of g using ConnectedComponents[g]. HighLightGraph is showing individual vertices in a given component with the same color but this kind of presentation is not so useful for my purpose. I like to see the components linked to each other through binary links between the components.



SeedRandom[4];
g = RandomGraph[30, 50, DirectedEdges -> True];
gg = ConnectedComponents[g];
CommunityGraphPlot[g, CommunityRegionStyle -> LightGray,
Method -> "Centrality"];
HighlightGraph[g, Subgraph[g, #] & /@ gg];


Thanks.










share|improve this question











$endgroup$







  • 1




    $begingroup$
    does CommunityGraphPlot[g, gg, CommunityRegionStyle -> LightGray, Method -> "Centrality"] give what you need?
    $endgroup$
    – kglr
    Jul 17 at 4:19






  • 1




    $begingroup$
    @kglr: Yes, it gives what I want to see. In fact, your solution provides answers to several of my problems. Thank you very much...
    $endgroup$
    – Tugrul Temel
    Jul 17 at 4:27













3












3








3


2



$begingroup$


I have the following code plotting community structure of random graph g. As one can see, the community structure plot presents a nice visual impact. I like to generate a similar plot for the connected components of g using ConnectedComponents[g]. HighLightGraph is showing individual vertices in a given component with the same color but this kind of presentation is not so useful for my purpose. I like to see the components linked to each other through binary links between the components.



SeedRandom[4];
g = RandomGraph[30, 50, DirectedEdges -> True];
gg = ConnectedComponents[g];
CommunityGraphPlot[g, CommunityRegionStyle -> LightGray,
Method -> "Centrality"];
HighlightGraph[g, Subgraph[g, #] & /@ gg];


Thanks.










share|improve this question











$endgroup$




I have the following code plotting community structure of random graph g. As one can see, the community structure plot presents a nice visual impact. I like to generate a similar plot for the connected components of g using ConnectedComponents[g]. HighLightGraph is showing individual vertices in a given component with the same color but this kind of presentation is not so useful for my purpose. I like to see the components linked to each other through binary links between the components.



SeedRandom[4];
g = RandomGraph[30, 50, DirectedEdges -> True];
gg = ConnectedComponents[g];
CommunityGraphPlot[g, CommunityRegionStyle -> LightGray,
Method -> "Centrality"];
HighlightGraph[g, Subgraph[g, #] & /@ gg];


Thanks.







graphs-and-networks






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 17 at 6:38









user64494

4,1562 gold badges14 silver badges23 bronze badges




4,1562 gold badges14 silver badges23 bronze badges










asked Jul 17 at 3:53









Tugrul TemelTugrul Temel

1,0703 silver badges13 bronze badges




1,0703 silver badges13 bronze badges







  • 1




    $begingroup$
    does CommunityGraphPlot[g, gg, CommunityRegionStyle -> LightGray, Method -> "Centrality"] give what you need?
    $endgroup$
    – kglr
    Jul 17 at 4:19






  • 1




    $begingroup$
    @kglr: Yes, it gives what I want to see. In fact, your solution provides answers to several of my problems. Thank you very much...
    $endgroup$
    – Tugrul Temel
    Jul 17 at 4:27












  • 1




    $begingroup$
    does CommunityGraphPlot[g, gg, CommunityRegionStyle -> LightGray, Method -> "Centrality"] give what you need?
    $endgroup$
    – kglr
    Jul 17 at 4:19






  • 1




    $begingroup$
    @kglr: Yes, it gives what I want to see. In fact, your solution provides answers to several of my problems. Thank you very much...
    $endgroup$
    – Tugrul Temel
    Jul 17 at 4:27







1




1




$begingroup$
does CommunityGraphPlot[g, gg, CommunityRegionStyle -> LightGray, Method -> "Centrality"] give what you need?
$endgroup$
– kglr
Jul 17 at 4:19




$begingroup$
does CommunityGraphPlot[g, gg, CommunityRegionStyle -> LightGray, Method -> "Centrality"] give what you need?
$endgroup$
– kglr
Jul 17 at 4:19




1




1




$begingroup$
@kglr: Yes, it gives what I want to see. In fact, your solution provides answers to several of my problems. Thank you very much...
$endgroup$
– Tugrul Temel
Jul 17 at 4:27




$begingroup$
@kglr: Yes, it gives what I want to see. In fact, your solution provides answers to several of my problems. Thank you very much...
$endgroup$
– Tugrul Temel
Jul 17 at 4:27










1 Answer
1






active

oldest

votes


















5












$begingroup$

You can use the second argument of CommunityGraphPlot to specify any community structure (not necessarily a partition of the vertex set).



Using gg as the community structure



CommunityGraphPlot[g, gg, CommunityRegionStyle -> LightGray]


enter image description here



If you want to retain the layout of the original graph, you can use the function blobF from this answer to highlight groups of vertices with blobs:



SetProperty[g, PlotTheme->"IndexLabeled", ImageSize -> Large,
Epilog -> blobF[g, RandomColor[Length@gg],gg, .1] ]


enter image description here



SetProperty[g, ImageSize -> Large, Epilog -> blobF[g, RandomColor[Length@gg], gg, .05] ]


enter image description here






share|improve this answer











$endgroup$












  • $begingroup$
    I am having trouble with SelfLoops. In my graph, there are many self loops which I do not want to see. How can you drop them out of the final graph view?
    $endgroup$
    – Tugrul Temel
    Jul 18 at 3:33






  • 1




    $begingroup$
    @Tugrul, does SimpleGraph@g help?
    $endgroup$
    – kglr
    Jul 18 at 3:37










  • $begingroup$
    It works for adjacency matrix, though vertex names are removed, which I do not want.I have been struggling with this problem for a long time. When I plot a graph using SimpleGraph it drops the vertex names. I also tried SelfLoopStyle and SelfLoops but no success. I have a weighted directed graph with vertex names. I simply like to keep the integrity of the graph but when plotting it I do not want to see the selfloops with vertex names kept.
    $endgroup$
    – Tugrul Temel
    Jul 18 at 6:55






  • 1




    $begingroup$
    I was writing a new question but in the meantime I discovered an answer to my question about SelfLoops. Here is the code: SeedRandom[1]; am = RandomInteger[0, 1, 10, 10]; ag = AdjacencyGraph[am, VertexLabels -> "Name"]; vLabels = 1 -> AGR, 2 -> FIS, 3 -> CO1, 4 -> CO2, 5 -> MA1, 6 -> MA2, 7 -> EGW, 8 -> CST, 9 -> WHS, 10 -> HOT; SimpleGraph[ag, VertexLabels -> vLabels]
    $endgroup$
    – Tugrul Temel
    Jul 18 at 7:33







  • 1




    $begingroup$
    With version 12 updates, SimpleGraph works fine (it retains vertex names, edgeweights...) so if your adjacency graph has named vertices, that is, if you define it as ag2 = AdjacencyGraph[Values @ vLabels, am], then sg = SimpleGraph[ag2] retains vertex names: VertexList[sg] == VertexList[ag2] is True.
    $endgroup$
    – kglr
    Jul 18 at 7:54













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "387"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f202220%2fhow-to-plot-connected-components-in-the-format-of-community-structure-plot%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









5












$begingroup$

You can use the second argument of CommunityGraphPlot to specify any community structure (not necessarily a partition of the vertex set).



Using gg as the community structure



CommunityGraphPlot[g, gg, CommunityRegionStyle -> LightGray]


enter image description here



If you want to retain the layout of the original graph, you can use the function blobF from this answer to highlight groups of vertices with blobs:



SetProperty[g, PlotTheme->"IndexLabeled", ImageSize -> Large,
Epilog -> blobF[g, RandomColor[Length@gg],gg, .1] ]


enter image description here



SetProperty[g, ImageSize -> Large, Epilog -> blobF[g, RandomColor[Length@gg], gg, .05] ]


enter image description here






share|improve this answer











$endgroup$












  • $begingroup$
    I am having trouble with SelfLoops. In my graph, there are many self loops which I do not want to see. How can you drop them out of the final graph view?
    $endgroup$
    – Tugrul Temel
    Jul 18 at 3:33






  • 1




    $begingroup$
    @Tugrul, does SimpleGraph@g help?
    $endgroup$
    – kglr
    Jul 18 at 3:37










  • $begingroup$
    It works for adjacency matrix, though vertex names are removed, which I do not want.I have been struggling with this problem for a long time. When I plot a graph using SimpleGraph it drops the vertex names. I also tried SelfLoopStyle and SelfLoops but no success. I have a weighted directed graph with vertex names. I simply like to keep the integrity of the graph but when plotting it I do not want to see the selfloops with vertex names kept.
    $endgroup$
    – Tugrul Temel
    Jul 18 at 6:55






  • 1




    $begingroup$
    I was writing a new question but in the meantime I discovered an answer to my question about SelfLoops. Here is the code: SeedRandom[1]; am = RandomInteger[0, 1, 10, 10]; ag = AdjacencyGraph[am, VertexLabels -> "Name"]; vLabels = 1 -> AGR, 2 -> FIS, 3 -> CO1, 4 -> CO2, 5 -> MA1, 6 -> MA2, 7 -> EGW, 8 -> CST, 9 -> WHS, 10 -> HOT; SimpleGraph[ag, VertexLabels -> vLabels]
    $endgroup$
    – Tugrul Temel
    Jul 18 at 7:33







  • 1




    $begingroup$
    With version 12 updates, SimpleGraph works fine (it retains vertex names, edgeweights...) so if your adjacency graph has named vertices, that is, if you define it as ag2 = AdjacencyGraph[Values @ vLabels, am], then sg = SimpleGraph[ag2] retains vertex names: VertexList[sg] == VertexList[ag2] is True.
    $endgroup$
    – kglr
    Jul 18 at 7:54















5












$begingroup$

You can use the second argument of CommunityGraphPlot to specify any community structure (not necessarily a partition of the vertex set).



Using gg as the community structure



CommunityGraphPlot[g, gg, CommunityRegionStyle -> LightGray]


enter image description here



If you want to retain the layout of the original graph, you can use the function blobF from this answer to highlight groups of vertices with blobs:



SetProperty[g, PlotTheme->"IndexLabeled", ImageSize -> Large,
Epilog -> blobF[g, RandomColor[Length@gg],gg, .1] ]


enter image description here



SetProperty[g, ImageSize -> Large, Epilog -> blobF[g, RandomColor[Length@gg], gg, .05] ]


enter image description here






share|improve this answer











$endgroup$












  • $begingroup$
    I am having trouble with SelfLoops. In my graph, there are many self loops which I do not want to see. How can you drop them out of the final graph view?
    $endgroup$
    – Tugrul Temel
    Jul 18 at 3:33






  • 1




    $begingroup$
    @Tugrul, does SimpleGraph@g help?
    $endgroup$
    – kglr
    Jul 18 at 3:37










  • $begingroup$
    It works for adjacency matrix, though vertex names are removed, which I do not want.I have been struggling with this problem for a long time. When I plot a graph using SimpleGraph it drops the vertex names. I also tried SelfLoopStyle and SelfLoops but no success. I have a weighted directed graph with vertex names. I simply like to keep the integrity of the graph but when plotting it I do not want to see the selfloops with vertex names kept.
    $endgroup$
    – Tugrul Temel
    Jul 18 at 6:55






  • 1




    $begingroup$
    I was writing a new question but in the meantime I discovered an answer to my question about SelfLoops. Here is the code: SeedRandom[1]; am = RandomInteger[0, 1, 10, 10]; ag = AdjacencyGraph[am, VertexLabels -> "Name"]; vLabels = 1 -> AGR, 2 -> FIS, 3 -> CO1, 4 -> CO2, 5 -> MA1, 6 -> MA2, 7 -> EGW, 8 -> CST, 9 -> WHS, 10 -> HOT; SimpleGraph[ag, VertexLabels -> vLabels]
    $endgroup$
    – Tugrul Temel
    Jul 18 at 7:33







  • 1




    $begingroup$
    With version 12 updates, SimpleGraph works fine (it retains vertex names, edgeweights...) so if your adjacency graph has named vertices, that is, if you define it as ag2 = AdjacencyGraph[Values @ vLabels, am], then sg = SimpleGraph[ag2] retains vertex names: VertexList[sg] == VertexList[ag2] is True.
    $endgroup$
    – kglr
    Jul 18 at 7:54













5












5








5





$begingroup$

You can use the second argument of CommunityGraphPlot to specify any community structure (not necessarily a partition of the vertex set).



Using gg as the community structure



CommunityGraphPlot[g, gg, CommunityRegionStyle -> LightGray]


enter image description here



If you want to retain the layout of the original graph, you can use the function blobF from this answer to highlight groups of vertices with blobs:



SetProperty[g, PlotTheme->"IndexLabeled", ImageSize -> Large,
Epilog -> blobF[g, RandomColor[Length@gg],gg, .1] ]


enter image description here



SetProperty[g, ImageSize -> Large, Epilog -> blobF[g, RandomColor[Length@gg], gg, .05] ]


enter image description here






share|improve this answer











$endgroup$



You can use the second argument of CommunityGraphPlot to specify any community structure (not necessarily a partition of the vertex set).



Using gg as the community structure



CommunityGraphPlot[g, gg, CommunityRegionStyle -> LightGray]


enter image description here



If you want to retain the layout of the original graph, you can use the function blobF from this answer to highlight groups of vertices with blobs:



SetProperty[g, PlotTheme->"IndexLabeled", ImageSize -> Large,
Epilog -> blobF[g, RandomColor[Length@gg],gg, .1] ]


enter image description here



SetProperty[g, ImageSize -> Large, Epilog -> blobF[g, RandomColor[Length@gg], gg, .05] ]


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited Jul 17 at 5:59

























answered Jul 17 at 4:27









kglrkglr

207k10 gold badges237 silver badges470 bronze badges




207k10 gold badges237 silver badges470 bronze badges











  • $begingroup$
    I am having trouble with SelfLoops. In my graph, there are many self loops which I do not want to see. How can you drop them out of the final graph view?
    $endgroup$
    – Tugrul Temel
    Jul 18 at 3:33






  • 1




    $begingroup$
    @Tugrul, does SimpleGraph@g help?
    $endgroup$
    – kglr
    Jul 18 at 3:37










  • $begingroup$
    It works for adjacency matrix, though vertex names are removed, which I do not want.I have been struggling with this problem for a long time. When I plot a graph using SimpleGraph it drops the vertex names. I also tried SelfLoopStyle and SelfLoops but no success. I have a weighted directed graph with vertex names. I simply like to keep the integrity of the graph but when plotting it I do not want to see the selfloops with vertex names kept.
    $endgroup$
    – Tugrul Temel
    Jul 18 at 6:55






  • 1




    $begingroup$
    I was writing a new question but in the meantime I discovered an answer to my question about SelfLoops. Here is the code: SeedRandom[1]; am = RandomInteger[0, 1, 10, 10]; ag = AdjacencyGraph[am, VertexLabels -> "Name"]; vLabels = 1 -> AGR, 2 -> FIS, 3 -> CO1, 4 -> CO2, 5 -> MA1, 6 -> MA2, 7 -> EGW, 8 -> CST, 9 -> WHS, 10 -> HOT; SimpleGraph[ag, VertexLabels -> vLabels]
    $endgroup$
    – Tugrul Temel
    Jul 18 at 7:33







  • 1




    $begingroup$
    With version 12 updates, SimpleGraph works fine (it retains vertex names, edgeweights...) so if your adjacency graph has named vertices, that is, if you define it as ag2 = AdjacencyGraph[Values @ vLabels, am], then sg = SimpleGraph[ag2] retains vertex names: VertexList[sg] == VertexList[ag2] is True.
    $endgroup$
    – kglr
    Jul 18 at 7:54
















  • $begingroup$
    I am having trouble with SelfLoops. In my graph, there are many self loops which I do not want to see. How can you drop them out of the final graph view?
    $endgroup$
    – Tugrul Temel
    Jul 18 at 3:33






  • 1




    $begingroup$
    @Tugrul, does SimpleGraph@g help?
    $endgroup$
    – kglr
    Jul 18 at 3:37










  • $begingroup$
    It works for adjacency matrix, though vertex names are removed, which I do not want.I have been struggling with this problem for a long time. When I plot a graph using SimpleGraph it drops the vertex names. I also tried SelfLoopStyle and SelfLoops but no success. I have a weighted directed graph with vertex names. I simply like to keep the integrity of the graph but when plotting it I do not want to see the selfloops with vertex names kept.
    $endgroup$
    – Tugrul Temel
    Jul 18 at 6:55






  • 1




    $begingroup$
    I was writing a new question but in the meantime I discovered an answer to my question about SelfLoops. Here is the code: SeedRandom[1]; am = RandomInteger[0, 1, 10, 10]; ag = AdjacencyGraph[am, VertexLabels -> "Name"]; vLabels = 1 -> AGR, 2 -> FIS, 3 -> CO1, 4 -> CO2, 5 -> MA1, 6 -> MA2, 7 -> EGW, 8 -> CST, 9 -> WHS, 10 -> HOT; SimpleGraph[ag, VertexLabels -> vLabels]
    $endgroup$
    – Tugrul Temel
    Jul 18 at 7:33







  • 1




    $begingroup$
    With version 12 updates, SimpleGraph works fine (it retains vertex names, edgeweights...) so if your adjacency graph has named vertices, that is, if you define it as ag2 = AdjacencyGraph[Values @ vLabels, am], then sg = SimpleGraph[ag2] retains vertex names: VertexList[sg] == VertexList[ag2] is True.
    $endgroup$
    – kglr
    Jul 18 at 7:54















$begingroup$
I am having trouble with SelfLoops. In my graph, there are many self loops which I do not want to see. How can you drop them out of the final graph view?
$endgroup$
– Tugrul Temel
Jul 18 at 3:33




$begingroup$
I am having trouble with SelfLoops. In my graph, there are many self loops which I do not want to see. How can you drop them out of the final graph view?
$endgroup$
– Tugrul Temel
Jul 18 at 3:33




1




1




$begingroup$
@Tugrul, does SimpleGraph@g help?
$endgroup$
– kglr
Jul 18 at 3:37




$begingroup$
@Tugrul, does SimpleGraph@g help?
$endgroup$
– kglr
Jul 18 at 3:37












$begingroup$
It works for adjacency matrix, though vertex names are removed, which I do not want.I have been struggling with this problem for a long time. When I plot a graph using SimpleGraph it drops the vertex names. I also tried SelfLoopStyle and SelfLoops but no success. I have a weighted directed graph with vertex names. I simply like to keep the integrity of the graph but when plotting it I do not want to see the selfloops with vertex names kept.
$endgroup$
– Tugrul Temel
Jul 18 at 6:55




$begingroup$
It works for adjacency matrix, though vertex names are removed, which I do not want.I have been struggling with this problem for a long time. When I plot a graph using SimpleGraph it drops the vertex names. I also tried SelfLoopStyle and SelfLoops but no success. I have a weighted directed graph with vertex names. I simply like to keep the integrity of the graph but when plotting it I do not want to see the selfloops with vertex names kept.
$endgroup$
– Tugrul Temel
Jul 18 at 6:55




1




1




$begingroup$
I was writing a new question but in the meantime I discovered an answer to my question about SelfLoops. Here is the code: SeedRandom[1]; am = RandomInteger[0, 1, 10, 10]; ag = AdjacencyGraph[am, VertexLabels -> "Name"]; vLabels = 1 -> AGR, 2 -> FIS, 3 -> CO1, 4 -> CO2, 5 -> MA1, 6 -> MA2, 7 -> EGW, 8 -> CST, 9 -> WHS, 10 -> HOT; SimpleGraph[ag, VertexLabels -> vLabels]
$endgroup$
– Tugrul Temel
Jul 18 at 7:33





$begingroup$
I was writing a new question but in the meantime I discovered an answer to my question about SelfLoops. Here is the code: SeedRandom[1]; am = RandomInteger[0, 1, 10, 10]; ag = AdjacencyGraph[am, VertexLabels -> "Name"]; vLabels = 1 -> AGR, 2 -> FIS, 3 -> CO1, 4 -> CO2, 5 -> MA1, 6 -> MA2, 7 -> EGW, 8 -> CST, 9 -> WHS, 10 -> HOT; SimpleGraph[ag, VertexLabels -> vLabels]
$endgroup$
– Tugrul Temel
Jul 18 at 7:33





1




1




$begingroup$
With version 12 updates, SimpleGraph works fine (it retains vertex names, edgeweights...) so if your adjacency graph has named vertices, that is, if you define it as ag2 = AdjacencyGraph[Values @ vLabels, am], then sg = SimpleGraph[ag2] retains vertex names: VertexList[sg] == VertexList[ag2] is True.
$endgroup$
– kglr
Jul 18 at 7:54




$begingroup$
With version 12 updates, SimpleGraph works fine (it retains vertex names, edgeweights...) so if your adjacency graph has named vertices, that is, if you define it as ag2 = AdjacencyGraph[Values @ vLabels, am], then sg = SimpleGraph[ag2] retains vertex names: VertexList[sg] == VertexList[ag2] is True.
$endgroup$
– kglr
Jul 18 at 7:54

















draft saved

draft discarded
















































Thanks for contributing an answer to Mathematica Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f202220%2fhow-to-plot-connected-components-in-the-format-of-community-structure-plot%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?