print basic statistics about an edge, e.g. layer/attribute counts

def edge_statistics(docgraph):
    """print basic statistics about an edge, e.g. layer/attribute counts"""
    print "Edge statistics\n==============="
    layer_counts = Counter()
    attrib_counts = Counter()
    source_counts = Counter()
    target_counts = Counter()
    for source, target, edge_attrs in docgraph.edges_iter(data=True):
        for layer in edge_attrs['layers']:
            layer_counts[layer] += 1
        for attrib in edge_attrs:
            attrib_counts[attrib] += 1
        source_counts[source] += 1
        target_counts[target] += 1

    print "\nnumber of edges with layers"
    print_sorted_counter(layer_counts)
    print "\nnumber of edges with attributes"
    print_sorted_counter(attrib_counts)

    print "\nmost common source edges"
    print_most_common(source_counts)
    print "\nmost common target edges"
    print_most_common(target_counts)