Generalized logm plugin so that any input graph can be used. Vertex names are kept after running the plugin.