graph.intersection在igraph中不起作用

时间:2017-04-25 19:35:30

标签: r igraph

以下是一个例子:

$username = $_POST["textfield"]; //unsafe
$username = mysql_real_escape_string($username); //safe

$email = mysql_real_escape_string($_POST["email"]);
$password = mysql_real_escape_string($_POST["password"]);
$number = mysql_real_escape_string($_POST["number"]);

$db=mysqli_select_db($conn,$database_conn);
$q1= "insert into users(username,email,password,number)values('".$username ."','".$email."','".$password."','".$number."')";
$q2=mysqli_query($conn,$q1);

现在创建一个列表

df1 <- graph.data.frame(V1=c(1,1,2,2,3,4), V2=c(2,3,3,5,5,5))
g1 <- graph.data.frame(df1, directed=F)
df2 <- data.frame(V1=c(1,2,2,3,4), V2=c(3,3,5,5,5))
g2 <- graph.data.frame(df2, directed=F)
df3 <- data.frame(V1=c(1,2,3,4), V2=c(3,3,5,5))
g3 <- graph.data.frame(df3, directed=F)
df4 <- data.frame(V1=c(1,1,2,3), V2=c(2,3,4,5))
g4 <- graph.data.frame(df4, directed=F)

现在寻找交叉点

mylist <- list(g1, g2, g3, g4)

但我得到了这个奇怪的结果:

  res <- intersection(mylist, keep.all.vertices=FALSE)

感谢任何帮助,我正在使用 Error in useMethod(intersection): no applicable method for 'intersection' applied to an object of class list

1 个答案:

答案 0 :(得分:1)

这看起来有点像黑客,但你可以获得你正在寻找的功能:

do.call(intersection, c(mylist, keep.all.vertices=FALSE))