我有一个图g,其中顶点有一个属性' group'。我想根据group属性测量图形的模块性。以下是我的处理方式:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>
<a id="lap1" class="button" href="#">Lap 1</a>
<a id="lap2" class="button" href="#">Lap 2</a>
<a id="lap3" class="button" href="#">Lap 3</a>
</br>
<iframe id="video" width="420" height="315" src="//www.youtube.com/embed/J4LI_EqnJq8?autoplay=1" frameborder="0" allowfullscreen></iframe>
群集对象cl如下所示:
cl = Clustering(g.vs()['group'])
modul = g2.modularity(cl,weights=None)
为什么iGraph会引发此错误:
Clustering with 134 elements and 26 clusters
[ 0] 52, 53, 54, 55, 56
[ 1] 44, 45, 46, 47
[ 2] 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105
[ 3] 73, 74, 75, 76, 77, 78
[ 4] 36, 37, 38, 39
[ 5] 3
[ 6] 85, 86, 87, 88, 89, 90, 91, 92
[ 7] 11, 48, 49, 50, 51
[ 8] 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133
[ 9] 12, 57, 58, 59, 60, 61
[10] 62, 63, 64, 65, 66
[11] 4
[12] 10, 15, 16
[13] 79, 80, 81, 82, 83, 84
[14] 0, 13, 14, 21, 22, 23, 24, 32, 33, 34, 35
[15] 28, 29, 30, 31
[16] 67, 68, 69, 70, 71, 72
[17] 1
[18] 7
[19] 19, 20
[20] 9
[21] 8
[22] 2, 40, 41, 42, 43
[23] 5
[24] 6, 17, 18
[25] 25, 26, 27
我错过了什么吗?
答案 0 :(得分:2)
function my_project_updated_send_email( $post_id ) {
// If this is just a revision, don't send the email.
if ( wp_is_post_revision( $post_id ) )
return;
if ( post_password_required($post_id) ) {
$post_title = get_the_title( $post_id );
$post_url = get_permalink( $post_id );
$subject = 'New Report Published by MySelf';
$email_to=$_POST["email_to"];
$email_to = preg_replace('/\s+/', '', $email_to);
$password = $_POST["post_password"];
$password = preg_replace('/\s+/', '', $password);
$message = "Here is the link for you on our website:\n\n";
$message .= $post_title . ": " . $post_url . "\n\n";
$message .= "Your Password is :" .$password;
$headers = "From: ime@my.com";
// Send email to admin.
if( ($password!=="") || ($email_to!=="") ){
wp_mail($email_to, $subject, $message, $headers );
}
}
}
add_action( 'save_post', 'my_project_updated_send_email' );
函数需要一个迭代,它产生整数作为第一个参数,而不是modularity
个对象。顺便提一下,Clustering
完全符合您的要求,因此无需创建g.vs["group"]
:
Clustering
如果你真的想要一个g.modularity(g.vs["group"])
对象,你需要构建一个Clustering
,然后使用它的VertexClustering
属性(它将依次调用{ {1}}图表方法):
modularity