Learning Weighted Product Spaces Representations for Graphs of Heterogeneous Structure