#Create a network with three edges
m<-matrix(0,3,3)
m[1,2]<-1; m[2,3]<-1; m[3,1]<-1
g<-network(m)
#Assign some attributes
g<-set.edge.attribute(g,"myeval",3:5)
g<-set.edge.value(g,"myeval2",m*5)
g<-set.network.attribute(g,"mygval","boo")
g<-set.vertex.attribute(g,"myvval",letters[1:3])
#List the attributes
list.edge.attributes(g)
list.network.attributes(g)
list.vertex.attributes(g)
#Retrieve the attributes
get.edge.attribute(g$mel,"myeval") #Note the first argument!
get.edge.value(g,"myeval") #Another way to do this
get.edge.attribute(g$mel,"myeval2")
get.network.attribute(g,"mygval")
get.vertex.attribute(g,"myvval")
#Purge the attributes
g<-delete.edge.attribute(g,"myeval")
g<-delete.edge.attribute(g,"myeval2")
g<-delete.network.attribute(g,"mygval")
g<-delete.vertex.attribute(g,"myvval")
#Verify that the attributes are gone
list.edge.attributes(g)
list.network.attributes(g)
list.vertex.attributes(g)
Run the code above in your browser using DataLab