我如何通过Python或C来做这个程序:(帮我 [英] How I do this program by Python or C please :( help me

查看:60
本文介绍了我如何通过Python或C来做这个程序:(帮我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

输入:表示有向图边缘的有序顶点对列表



输出:确定度数:每个度的度数和出度顶点。



我尝试过:



我试过用矩阵,但我不知道如何做下一步

Input: A list of ordered pairs of vertices representing the edges of a directed graph

Output: determines the degree: in-degree and out-degree of each vertex.

What I have tried:

I tried to use matrix but i don't know how to do next

推荐答案

这是矢量算术。首先计算极坐标系中的距离和角度,然后从另一个值中加上或减去它。



但请注意:你有极地系统的4个角落,其中计算有点不同!!!所以检查结果。请:总是!!!



当您可以使用C ++时,您可以在提升库
It is the classical case of vector arithmetics. You first compute the distance and angle in the polar system and than add or substract it from the other value.

But watch out: you have 4 corners of the polar system in which calculation differs a bit!!! So check the results. Please: always!!!

When you can use C++ you may find some helpful tools like coordinate_vector in the boost libraries.


这篇关于我如何通过Python或C来做这个程序:(帮我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆