def compare_communities(comm1, comm2, method='vi', remove_none=False):
    'Compares two community structures using various distance measures.\n\n    @param comm1: the first community structure as a membership list or\n      as a L{Clustering} object.\n    @param comm2: the second community structure as a membership list or\n      as a L{Clustering} object.\n    @param method: the measure to use. C{"vi"} or C{"meila"} means the\n      variation of information metric of Meila (2003), C{"nmi"} or C{"danon"}\n      means the normalized mutual information as defined by Danon et al (2005),\n      C{"split-join"} means the split-join distance of van Dongen (2000),\n      C{"rand"} means the Rand index of Rand (1971), C{"adjusted_rand"}\n      means the adjusted Rand index of Hubert and Arabie (1985).\n    @param remove_none: whether to remove C{None} entries from the membership\n      lists. This is handy if your L{Clustering} object was constructed using\n      L{VertexClustering.FromAttribute} using an attribute which was not defined\n      for all the vertices. If C{remove_none} is C{False}, a C{None} entry in\n      either C{comm1} or C{comm2} will result in an exception. If C{remove_none}\n      is C{True}, C{None} values are filtered away and only the remaining lists\n      are compared.\n\n    @return: the calculated measure.\n    @newfield ref: Reference\n    @ref: Meila M: Comparing clusterings by the variation of information.\n          In: Scholkopf B, Warmuth MK (eds). Learning Theory and Kernel\n          Machines: 16th Annual Conference on Computational Learning Theory\n          and 7th Kernel Workship, COLT/Kernel 2003, Washington, DC, USA.\n          Lecture Notes in Computer Science, vol. 2777, Springer, 2003.\n          ISBN: 978-3-540-40720-1.\n    @ref: Danon L, Diaz-Guilera A, Duch J, Arenas A: Comparing community\n          structure identification. J Stat Mech P09008, 2005.\n    @ref: van Dongen D: Performance criteria for graph clustering and Markov\n          cluster experiments. Technical Report INS-R0012, National Research\n          Institute for Mathematics and Computer Science in the Netherlands,\n          Amsterdam, May 2000.\n    @ref: Rand WM: Objective criteria for the evaluation of clustering\n          methods. J Am Stat Assoc 66(336):846-850, 1971.\n    @ref: Hubert L and Arabie P: Comparing partitions. Journal of\n          Classification 2:193-218, 1985.\n    '
    import igraph._igraph
    (vec1, vec2) = _prepare_community_comparison(comm1, comm2, remove_none)
    return igraph._igraph._compare_communities(vec1, vec2, method)
Compares two community structures using various distance measures.

@param comm1: the first community structure as a membership list or
  as a L{Clustering} object.
@param comm2: the second community structure as a membership list or
  as a L{Clustering} object.
@param method: the measure to use. C{"vi"} or C{"meila"} means the
  variation of information metric of Meila (2003), C{"nmi"} or C{"danon"}
  means the normalized mutual information as defined by Danon et al (2005),
  C{"split-join"} means the split-join distance of van Dongen (2000),
  C{"rand"} means the Rand index of Rand (1971), C{"adjusted_rand"}
  means the adjusted Rand index of Hubert and Arabie (1985).
@param remove_none: whether to remove C{None} entries from the membership
  lists. This is handy if your L{Clustering} object was constructed using
  L{VertexClustering.FromAttribute} using an attribute which was not defined
  for all the vertices. If C{remove_none} is C{False}, a C{None} entry in
  either C{comm1} or C{comm2} will result in an exception. If C{remove_none}
  is C{True}, C{None} values are filtered away and only the remaining lists
  are compared.

@return: the calculated measure.
@newfield ref: Reference
@ref: Meila M: Comparing clusterings by the variation of information.
      In: Scholkopf B, Warmuth MK (eds). Learning Theory and Kernel
      Machines: 16th Annual Conference on Computational Learning Theory
      and 7th Kernel Workship, COLT/Kernel 2003, Washington, DC, USA.
      Lecture Notes in Computer Science, vol. 2777, Springer, 2003.
      ISBN: 978-3-540-40720-1.
@ref: Danon L, Diaz-Guilera A, Duch J, Arenas A: Comparing community
      structure identification. J Stat Mech P09008, 2005.
@ref: van Dongen D: Performance criteria for graph clustering and Markov
      cluster experiments. Technical Report INS-R0012, National Research
      Institute for Mathematics and Computer Science in the Netherlands,
      Amsterdam, May 2000.
@ref: Rand WM: Objective criteria for the evaluation of clustering
      methods. J Am Stat Assoc 66(336):846-850, 1971.
@ref: Hubert L and Arabie P: Comparing partitions. Journal of
      Classification 2:193-218, 1985.
def compare_communities(comm1, comm2, method='vi', remove_none=False):
    'Compares two community structures using various distance measures.\n\n    @param comm1: the first community structure as a membership list or\n      as a L{Clustering} object.\n    @param comm2: the second community structure as a membership list or\n      as a L{Clustering} object.\n    @param method: the measure to use. C{"vi"} or C{"meila"} means the\n      variation of information metric of Meila (2003), C{"nmi"} or C{"danon"}\n      means the normalized mutual information as defined by Danon et al (2005),\n      C{"split-join"} means the split-join distance of van Dongen (2000),\n      C{"rand"} means the Rand index of Rand (1971), C{"adjusted_rand"}\n      means the adjusted Rand index of Hubert and Arabie (1985).\n    @param remove_none: whether to remove C{None} entries from the membership\n      lists. This is handy if your L{Clustering} object was constructed using\n      L{VertexClustering.FromAttribute} using an attribute which was not defined\n      for all the vertices. If C{remove_none} is C{False}, a C{None} entry in\n      either C{comm1} or C{comm2} will result in an exception. If C{remove_none}\n      is C{True}, C{None} values are filtered away and only the remaining lists\n      are compared.\n\n    @return: the calculated measure.\n    @newfield ref: Reference\n    @ref: Meila M: Comparing clusterings by the variation of information.\n          In: Scholkopf B, Warmuth MK (eds). Learning Theory and Kernel\n          Machines: 16th Annual Conference on Computational Learning Theory\n          and 7th Kernel Workship, COLT/Kernel 2003, Washington, DC, USA.\n          Lecture Notes in Computer Science, vol. 2777, Springer, 2003.\n          ISBN: 978-3-540-40720-1.\n    @ref: Danon L, Diaz-Guilera A, Duch J, Arenas A: Comparing community\n          structure identification. J Stat Mech P09008, 2005.\n    @ref: van Dongen D: Performance criteria for graph clustering and Markov\n          cluster experiments. Technical Report INS-R0012, National Research\n          Institute for Mathematics and Computer Science in the Netherlands,\n          Amsterdam, May 2000.\n    @ref: Rand WM: Objective criteria for the evaluation of clustering\n          methods. J Am Stat Assoc 66(336):846-850, 1971.\n    @ref: Hubert L and Arabie P: Comparing partitions. Journal of\n          Classification 2:193-218, 1985.\n    '
    import igraph._igraph
    (vec1, vec2) = _prepare_community_comparison(comm1, comm2, remove_none)
    return igraph._igraph._compare_communities(vec1, vec2, method)