def igraph_centrality(g, weights='weight', cost=False, damping=0.99):
    """Return dict of vertex centrality measures

    Parameters
    ----------
    g : igraph object
        may be directed or indirected, weighted or unweighted
    weights : str, default='weight'
        name of node attribute to weight edges, Set to None for unweighted
    cost : bool, default is False
        if True, then weights are costs; else weights are importances

    Returns
    -------
    result : dict of {centrality str : score float}
        if cost: 'eigenvector', 'pagerank', 'authority', 'hub' ignore weights
        if not cost: 'betweenness', 'closeness' ignore weights
    """
    if not g.is_weighted() or not weights in g.es.attribute_names():
        weights = None
    out = dict()
    #out['indegree'] = g.indegree()
    #out['outdegree'] = g.outdegree()
    out['outweight'] = g.strength(weights=weights, mode='out')
    out['inweight'] = g.strength(weights=weights, mode='in')

    # weights applicable only if importance
    if not g.is_weighted():
        out['eigenvector'] = g.eigenvector_centrality(weights=weights if not cost
                                                      else None)
    out['pagerank'] = g.pagerank(weights=weights if not cost else None,
                                 damping=damping)
    out['authority'] = g.authority_score(weights=weights if not cost else None)
    out['hub'] = g.hub_score(weights=weights if not cost else None)

    # weights applicable only if cost
    out['betweenness'] = g.betweenness(weights=weights if cost else None)
    out['closeness'] = g.closeness(weights=weights if cost else None)
    
    #out['clustering'] = g.as_undirected().transitivity_local_undirected()
    return out