FForellin
उत्पाद

प्रोग्राम की सुविधाएँ · न्यूनतम विस्तार वन

01

spanning_forest.py में सबसे सस्ते वन को सबसे छोटे पथ या मनमाने समूह से अलग समझें।

01

मॉडल

बेस URL और आवश्यक होने पर API कुंजी से OpenAI-संगत या Anthropic endpoint सेट करें। कनेक्शन जाँचें। स्थानीय मॉडल सर्वर चालू होना चाहिए; दूरस्थ उपकरण अलग से डेटा भेज सकते हैं।

02

प्रोजेक्ट

फ़ोल्डर चुनें और संपादन से पहले सहायक से संबंधित फ़ाइलें पढ़ने को कहें। काम का उद्देश्य और सीमाएँ बताएँ।

03

बदलाव

बदलाव और कमांड का आउटपुट देखें। परिणाम स्वीकार करने से पहले प्रोजेक्ट की जाँच चलाएँ; बनाया गया कोड अपने आप परीक्षण किया हुआ नहीं होता।

न्यूनतम विस्तार वन

● ● ●Forellin●
कार्यप्रवाह · न्यूनतम विस्तार वन ×
def spanning_forest(count, edges):
    if type(count) is not int or not 0 <= count <= 64 or type(edges) is not list or len(edges) > 1024:
        raise ValueError("forest.input")
    ordered = []
    for edge in edges:
        if type(edge) not in (list, tuple) or len(edge) != 3 or any(type(x) is not int for x in edge):
            raise ValueError("forest.edge")
        a, b, weight = edge
        if not 0 <= a < count or not 0 <= b < count or abs(weight) > 10**9:
            raise ValueError("forest.bounds")
        ordered.append((weight, min(a, b), max(a, b)))
    parent = list(range(count))
    def root(node):
        while parent[node] != node:
            parent[node] = parent[parent[node]]
            node = parent[node]
        return node
    selected, total = [], 0
    for weight, a, b in sorted(ordered):
        x, y = root(a), root(b)
        if x != y:
            parent[x] = y
            selected.append((a, b, weight))
            total += weight
    return total, selected
✳न्यूनतम विस्तार वन
✓ बदलावलागू करने से पहले समीक्षा करें ↗
कार्यक्षेत्र का चित्रण
AI के साथ कोड का कार्यक्षेत्र

आपका अगला विचार यहीं शुरू होता है।

Windows के लिए डाउनलोड करें ↗