Best way to create a weighted edge graph

You should be able to see aggregation queries generated by Dgraph. Use GraphQL Playground or any other that you can explore the documentation generated by GraphQL. Count is possible with aggregation queries in GraphQL. Another way is creating custom DQL queries. But that is a another level. You need more exposure time with Dgraph.

BTW, I think you should pick DQL instead of GraphQL. GraphQL is a bit hard, the spec is pretty limited and strict. It is nice when you know how to get around with the lang. And when you are using for front-end. But applications like AI, I think DQL is way better.