PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, June 28, 2022

[FIXED] How to resolve 'only connected graphs are supported' issue in ggraph in R?

 June 28, 2022     ggraph, graph, igraph, plot     No comments   

Issue

I have a graph object, but when plotted using ggraph() using layout 'sparse_stress' (also tried other layouts), it is followed with the below error.

The min(degree) is 1. There are no disconnected nodes. What does the error mean by "only connected graphs are supported"?

Subgraph_1994 = asIgraph(Subgraph_1994)

#sparse-stress gives error
ggraph(Subgraph_1994_Rev,layout="sparse_stress") + geom_edge_link() + geom_node_point() + theme_graph()

#also tried below but same error
ggraph(Subgraph_1994) + geom_edge_link() + geom_node_point() + theme_graph()

Error Message

Error in layout_with_sparse_stress(graph, pivots = pivots, weights = weights, : only connected graphs are supported.


Solution

Min(degree)=1 means there are no disconnected nodes indeed, but there still might be disconnected graphs. See the graphlayouts README on github

Setting layout="sparse" should fix your problem if the graph is not too big.



Answered By - krltrl
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing