2017-11-22 8 views

답변

0

다음은 기존 .graphml 파일의 igraph 그래프 목록을 작성하는 코드입니다. 그래프는 오직 (양수) 숫자 값으로 작동합니다. 그래서 저는 사업자를 숫자 코드로 대체해야했습니다. 나는 (* == 1)을 사용했다. 그렇지 않으면 및 CalculateVertexHistKernel (G) 함수가 충돌합니다.

#loading the files 
g1 <- read.graph("15_4.graphml", format = "graphml") 
g2 <- read.graph("30_2.graphml", format = "graphml") 

#replacing * with 1 
V(G[[1]])$label 
[1] NaN 15 4 #NaN is the * 
V(G[[2]])$label 
[1] NaN 30 2 

V(G[[1]])$label[1] <- 1 
V(G[[2]])$label[1] <- 1 

#creating the list 
gList = list(g1,g2) 

#computing similarity 
k<-CalculateVertexHistKernel(gList) 

패키지 작성자 Dr. Sugiyama는이 솔루션을 제공했습니다.