You can use the as_data_frame()
function from igraph and then remove the first column which contains the node identifiers. Here is an example:
library(igraph)
# create a sample graph with constraints
g <- graph.formula(1-2-3-4-5, 2-4-5)
set.vertex.attribute(g, "c1", c(1, 0, 0, 0, 1))
set.vertex.attribute(g, "c2", c(1, 0, 0, 1, 1))
# export constraints to data frame without node identifiers
df <- as_data_frame(g, what = "vertices", attrs = c("c1", "c2"))
df <- df[, -1]
The resulting data frame df
will have the constraints in columns, without the node identifiers.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-03 15:22:26 +0000
Seen: 12 times
Last updated: May 03 '23
How can I export WordPress users who have not logged in?
How can a button be made to export data to Excel in Power BI?
How can I utilize the export default function to construct buttons in react version 16?
What problem arises when attempting to export a data table to Excel?
What is the method to utilize jsPDF's html() functionality within LWC?
What is the method for exporting members of a module that has been opened in Dafny?
While debugging in Visual Studio 2019, how can objects be exported?
What is the procedure to use React libraries and antd table to export data to Excel?
Is it not possible to export data using getStaticProps() in Nextjs?